difference between onclick and onsubmit?

Posted by Rajeshk under Interview Questions on 4/14/2013 | Points: 10 | Views : 10834 | Status : [Member] | Replies : 3
hi all,
can anybody tell me the difference between onclick and onsubmit events with example?

Thanks&Regards
rajeshkommireddy@gmail.com



Responses

Posted by: Satyapriyanayak on: 4/14/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
onSubmit()
1.Event Category:
onSubmit() is a form event.

2.When it occurs:
This event occurs when we try to submit a form.
3.When to use:
We can put our form validation against this event type.

onClick()
1.Event Category:
onClick() is a mouse event.

2.When it occurs:
This event occurs when a user clicks mouse left button.

3.When to use:
We can put our validation, warning etc against this event type.

Refer http://www.tutorialspoint.com/javascript/javascript_events.htm


If this post helps you mark it as answer
Thanks

Rajeshk, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Raj.Trivedi on: 4/14/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hello

Onsubmit event will submit the complete form to a particular action on the form

onClick event will not submit the entire form but will submit the data depending upon the logic

Regard's
Raj.Trivedi
"Sharing is Caring"
Please mark as answer if your Query is resolved

Rajeshk, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyapriyanayak on: 4/28/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
If this post helps you mark it as answer
Thanks

If this post helps you mark it as answer
Thanks

Rajeshk, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response