Thursday, 15 July 2010

javascript - Add variable to end of href URL onClick JQUERY -


I think this should work, but no. Not sure what I'm doing.

addURL () {$ (this) .attr ('href', function () {return.href + '& cylnders = 12';} & lt; an onclick = "AddURL ();" href = "/ search-results /? Var1 = red & amp; var2 = leather" & gt; click on & lt; / a & gt;
  function addURL () {$ (This) .attr ('href', function () {return.href + '& cylnders = 12';})}}   

Second, in your code "this" Instead, try this:

  one onclick = "addURL (this)" href = "/ search-results /? Var1 = red and var2 = leather" & Gt;; Lt; / a & gt; Click on function addURL (element) {$ (element) .attr ('href', function () {this.href + 'and cylnders = 12';});}  / Pre>  

No comments:

Post a Comment