I have this link :
<a href="#" onClick="addSide('1');return false">Link</a>
and I want that, when I click on a button (for example), the value of addSide in that link grow. Such as first click on the button I want to pass to the addSide function 1, second click
addSide(‘2’), and so on…
So, is it possible change value of the addSide function, trought jQuery, by editing this and replace with somethings like addSide('another_value')?
EDIT
I see is not so clear my question. So I give an example 🙂
This is the code I want to edit :
<div class="trackon" id="trackline">
<span class="trackbotton1">
<a class="lblueb" href="#" onClick="addSide('');return false">Add Side</a>
</span>
</div>
I wrote this :
$('#trackline').find('.trackbotton1').children().attr('onclick', 'alert("example");return false');
but the function doesnt change…
Edit This is based on Jimmy Sawczuk’s approach, and it works.
HTML
JS
Old answer – This doesn’t work.