I tried a clean version of @arnorhs, and although it is cleaner and more compact, there is a slight perplexity in the code, since href should be this.href:
$('a').each(function(){ var sep = (this.href.indexOf('?') != -1) ? '&' : '?'; $(this).attr('href', this.href + sep + 'Hello=True'); });
and
$('a').each(function(){ $(this).attr('href', this.href + ((this.href.indexOf('?')!=-1)?'&':'?') + 'Hello=True'); });
In a similar vein, the more compact version commented on by @Jan Willem B has this minor issue twice and should read:
$('a').each(function(){ var sep = (this.href.indexOf('?') != -1) ? '&' : '?'; $(this).attr('href', this.href + sep + 'Hello=True'); });
Otherwise, both posts and comments look great, and the (latest) compact version works beautifully (did not test the rest).
NOTE. Due to the threshold of reputation points, I had to post a comment or comment. NTN.
nikolaosinlight
source share