I have a button:
<button onclick = "doDisactivate(5);" id = "status_button_5" value = "Disactivate" />
where 5 is a dynamically added ID. I have two javascript functions, doDisactivate(ID) and doActivate(5).
function doDisactivate(serviceID) {
// logic that changes the button onclick to doActivate(serviceID)
}
function doActivate(serviceID) {
// logic that changes the button onclick to doActivate(serviceID)
}
I'm guessing I can do the following with jquery:
${"#status_button_" + serviceID}.click(function() {
doActivate(serviceID);
});
But is there a way to directly assign the function while passing the ID as a parameter?