Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JS: jQuery Replace HREF Query String
// www.website.com/page?id=100
$('#pageLink').attr('href', $('#pageLink').attr('href').replace(/((\?|&)id\=)[0-9]*/, '$1' + '123'));
// www.website.com/page?id=123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.