Reputation: 325
Came across a code in which the submit()
event has been applied to the input field in the form.
Something like:
$("#foo").click(function(){
$("#formID input").submit();
})
where "#foo"
is a dynamically created list element. Does this submit only the input field and not the entire form?
Upvotes: 0
Views: 1245
Reputation: 943207
Since it is being called without any arguments, it will trigger a submit event.
This will bubble and trigger any submit event handlers on that element and any of its ancestors.
It will not trigger any native submission of data (that would require the method to be called on a form element).
Upvotes: 1