I want to toggle between two images one is "edit.png" and another "ok.png", when page loads it should shows "edit.png" and when we click on edit.png it should changes to ok.png. i have tried with the following java script code, but this code is applying only to the first edit.png image in my table it is not applying to next edit.png image. Anyone suggest how can i apply this java script code to every edit.png image in my table. For table i used the "tabledit" plugin. screen shot my web page
var toggle = false;
function changing() {
if (toggle === true) {
document.getElementById('edit').src = '/concrete5/application/images/animated/btn_edit.png';
} else {
document.getElementById('edit').src = '/concrete5/application/images/animated/btn_ok.png';
}
toggle = !toggle;
}
<img src="/concrete5/application/images/animated/btn_edit.png" id="edit" onclick="changing()"/>