I need a jQuery code snippet which appends the parameter action=xyz to all urls within a page – note it should also check that if the urls already have other parameters appended or not: e.g., for a url such as index.php?i=1 it should append &action=xyz and for urls without parameters like index.php it should append ?action=xyz.
I need a jQuery code snippet which appends the parameter action=xyz to all urls
Share
That finds all the
<a>tags and updates their “href” value as you described. You could turn it into a jQuery plugin if you need to pass different “xyz” values:Then you could just do
$('a').addAction("xyz");or, in your case,