I know this post is old as dirt but, I, being a total noob, was banging my head over a way to change a URL parameter value in a page rendered by SharePoint. Many of the answers I found were cryptic jquery one-liners that read like Charley Brown's teacher speaks......
Using jquery-3.2.0, and some insight from Bang Dao's post, I yielded this hard fought gem.
Situation
The URL containing the parameter I need to change:
<a class="ms-subtleLink" onclick="GoToLinkOrDialogNewWindow(this);return false;" href="/Site/SubSite/_layouts/15/userdisp.aspx?ID=27">UserName Text</a>
Problem I needed to change the ID parameter from 27 to 33 in every location on the page.
Solution
$('a.ms-subtleLink').attr('href',function(){this.href = this.href.replace('?ID=27','?ID=33')});
I realize I did not need to include '?ID=' as part of the replace string. I only included it to improve the degree of specificity in my match string.
I hope this helps someone with a similar issue some day.