How can i check whether a button is clicked or not using javascript
+1
A:
If you are talking about a <button>, use the onclick event.
The dirty way to do so would be <button onclick="your javascript here">...</button>.
The clean way is registering an event handler from your javascript code. e.g. if you are using jQuery in this way:
$('#id-of-your-button').click(function(e) {
e.preventDefault();
/* do something */
});`
The preventDefault() call ensures no side-effects like submitting a form occur. When using the dirty inline way, you can achieve that by ending the code with return false;.
ThiefMaster
2010-06-17 06:17:02
A:
write alert in the function which you are calling so that u will get an bit idea
mehul9595
2010-06-17 06:18:02