How can I go through each link on a page and append something with jQuery? -
I have a bunch of links on a page that is in an action, I run a function and such an additional variable Adds:
Function Store ID (UID) {$ ('a.special'). Each (function () {$ (this) .attr ('href', $ (this) .attr ('href') + 'and variable =' + uid + '');}); }
I understand, every link given above will go through, and hold the current href, then add the variable bits to the end I got the variable attached, but It is not working as expected ... like '& amp; Variable = 'adding part twice, for the first time, such as' & amp; Variable = undefined 'and then that' & amp; Variable = 23 '
Is there a better way to do this? Or in a way I just say through each of these links and just update that value which is set to variable instead of typing whole href?
So to be just repeated, my original link is just like this:
And its purpose is to look like the following after execution of the function:
But it looks like wind:
Are you sure that storeId is not being called twice? It seems like.
Comments
Post a Comment