Depending on what you mean, without editing each link.
If you mean that you simply do not want to manually add it to your source, you can do this:
$('a[href]').attr('href', function(i, hrf) { return hrf + '?ref=123';});
Or, if you meant that you did not want to do this, you can add a handler .click()that will add a value when the link is clicked.
$('a[href]').click(function( e ) {
e.preventDefault();
window.location = this.href + '?ref=123';
});
source
share