I have javascript call for an image during onclick event.
onclick="removeFeetype(5);"
I need to change that to onclick="removeFeetype(4); during some other call using the attribute ID by jQuery.
Which means I need to change the function call from 5 to 4.
Please I need your help. Thanks in advance.
I tried using the following code to change the "onclick" call method. But it is not changed on my html code for that particular element with the ID "removeButton".
------------------------FIRST-------------------------------
var changeval = 4;
var onclickval = "removeFeetype("+changeval+");";
$('#removeButton').attr("onclick", onclickval);
------------------------SECOND-----------------------------------------
var changeval = 4;
var next = "removeFeetype(" + changeval + ");";
var newclick_next = eval("(function(){"+next+"});");
$('#removeButton').attr('onclick','').unbind().click(newclick_next);
Actually my task is,
i have sequence for the rows with the ID
id="removeButton1" onclick="removeFeetype(1);"
id="removeButton2" onclick="removeFeetype(2);"
id="removeButton3" onclick="removeFeetype(3);"
id="removeButton4" onclick="removeFeetype(4);"
.....
If i delete the removeButton2 using the function removeFeetype(2).
then i need the change remaining to
ID = removeButton3 to removeButton2 and so on and
ONCLICK = removeFeetype(3) to removeFeetype(2) and so on
I can change the ID removeButton3 to removeButton2 and so on.
But i can't change the onclick method call from "removeFeetype(3);" to "removeFeetype(2);"
Hope now it is clear. Please help me to fix it.
$('link_element_id').click(function(){ //code here })