Replace
$('a[href*="/HelloWorld/default.aspx"]').append("href",$("?template=PW"))
WITH
$.each( $('a[href*="/HelloWorld/default.aspx"]'), function(index, value) { $(value).attr('href', $(value).attr('href') + '?template=PW'); } );
This will help you get started, but you should also check to see if the query string parameter is already in the agreed URL.
$ (). append () does not change the value of the href attribute, it is used to insert content at the end of each matching element. The jQuery documentation contains examples of using $ (). Append ().
source share