Loading…

What is the difference between onclick and onsubmit?

Onclick- it is a mouse event and occurs when the user clicks the left button of the mouse.

Onsubmit- it is a form event and occurs when a user is trying to submit the form. When form validation is used, then this is considered.

Example

                                        

$("p").click(function(){
     alert("You clicked here");
});

$("form").submit(function(){
    alert("You form submitted");
});

Suggest An Answer

No suggestions avaliable!

Latest post from JQuery interview questions

Ask Question