Add or update URL query parameter in JavaScript

Add or update URL query parameter with respect to number of parameters and its position.
Usage:

  • ‘http://www.website.com/’.urlQueryParameter(‘id’, 2) => http://www.website.com/?id=2
  • ‘http://www.website.com/?type=1’.urlQueryParameter(‘id’, 2) => http://www.website.com/?type=1&id=2

 




No Comments


You can leave the first : )



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.