I\'ve seen a lot of questions about the easiest way to change the value of a parameter, but nothing about how to change the parameter itself.
For example:
exampl
The code you provided gets the link(href) of the anchor that has mylink class.
With the link you replace the first occurrence of 'utm_' with 'sqf_'.
Then you replace the link(href) of the anchor with the new link.
To achieve change all occurrences of 'utm_' I used a regular expression /utm_/g.
I added a snippet to clarify:
$(document).ready(function(){
// Gets current href of element with class mylink
var url = $('.mylink').attr('href')
// Replace all occurences of utm_ with sqf_
url = url.replace(/utm_/g, 'sqf_')
// Replaces the old href with the new one on the anchor
$('.mylink').attr('href', url)
});
Link