Use jQuery's attr method to modify the onclick value


Okay, so I’m just going to stick you with the js code

var js = "alert('B:' + this.id); return false;";
var newclick = eval("(function(){"+js+"});");
$("#anchor").attr('onclick', '').click(newclick);

If the onclick event has a value, clear it, and then use the click(eval(function(){… })) assignment

$("input[name='orderCar']").attr('onclick','').click( eval(function(){Test()}));

function Test(){
alert(" Test passed! ");
return;
}

  If it can help you, please step on it.