In my page I have many edit buttons each name starts with “edit” and then some id. I want to know any of my edit buttons is clicked or not.
In details, I have form. In form I have many edit buttons which name starts with “edit” , delete buttons which name starts with “delete” and 1 add button. All are submit buttons. form onsubmit I call JavaScript function in which I want if the button is edit confirm(“some text”) else submit form.
How can I do that in JavaScript?
I think give all these buttons same id and then getElementById but then how con I change?
In my page I have many edit buttons each name starts with edit and
Share
This is simple using jQuery:
Try it out:
http://jsfiddle.net/7YEay/
UPDATE based on feedback in comments
This is untested/pseudo code:
This documentation may be helpful too: http://api.jquery.com/submit/