I am trying to add a variable at the end of my href using regex and jquery. Here's what I've done so far:
$ ('# survey-click1'). Click (function) {playerPause (); $ ("a [href ^ = http: / /d.surveysonline.com/]") .each (function () {this.href = [regex goes here] ;}); Return false;}); I'm just trying to add a variable at the end of the URL to which I clicked to click or not that I see the video was preroll or not. This is my URL code [AND. Preroll = "+ Kdp3State.preroll +"] can be easily done by attaching it. How can I find out the end of the href string to attach it to me? Thanks
Assuming that you really want to add your URL , It should work:
$ ("a [href = http: //d.surveysonline.com/]"). Each (function () ($ (this) .attr ('href', $ (this) .attr ('href', 'and; preroll =' + kdp3state.preroll);}); Apart from the fact that you use a CSS selector which is something similar to a raggeon, this question is not unrelated to this topic.
Comments
Post a Comment