Difference between onclick and onchange method in salesforce
Answers
Answered by
3
They're two completely separate events.
onclick events fire when the user uses the mouse to click on something.
onsubmit events fire when a form is submitted. The origin of this event can sometimes be traced back to an onclick(like clicking the "submit" button) but it can also come from a keyboard event (like pressing enter).
This implies that using onclick on a submit button on a form might miss some cases that an onsubmit on the form would catch.
There are many other kinds of events such as: onload for loading resources such as scripts or images and onkeydownfor detecting key presses on the keyboard.
onclick events fire when the user uses the mouse to click on something.
onsubmit events fire when a form is submitted. The origin of this event can sometimes be traced back to an onclick(like clicking the "submit" button) but it can also come from a keyboard event (like pressing enter).
This implies that using onclick on a submit button on a form might miss some cases that an onsubmit on the form would catch.
There are many other kinds of events such as: onload for loading resources such as scripts or images and onkeydownfor detecting key presses on the keyboard.
Similar questions