Computer Science, asked by hrushikeshkhady6022, 11 months ago

Check form which field is changed after submitting in jquery

Answers

Answered by manishkr620520
0
This method is a shortcut for .on( "submit", handler ) in the first variation, and .trigger( "submit" )in the third.

The submit event is sent to an element when the user is attempting to submit a form. It can only be attached to <form>elements. Forms can be submitted either by clicking an explicit <input type="submit">, <input type="image">, or <button type="submit">, or by pressing Enterwhen certain form elements have focus.

For example, consider the HTML:

1

2

3

4

5

6

7

<form id="target" action="destination.html">

<input type="text" value="Hello there">

<input type="submit" value="Go">

</form>

<div id="other">

Trigger the handler

</div>

The event handler can be bound to the form:

1

2

3

4

$( "#target" ).submit(function( event ) {

alert( "Handler for .submit() called." );

event.preventDefault();

});

Now when the form is submitted, the message is alerted. This happens prior to the actual submission, so we can cancel the submit action by calling .preventDefault() on the event object or by returning false from our handler. We can trigger the event manually when another element is clicked:

1

2

3

$( "#other" ).click(function() {

$( "#target" ).submit();

});

After this code executes, clicks on Trigger the handler will also display the message. In addition, the default submit action on the form will be fired, so the form will be submitted.

The JavaScript submit event does not bubble in Internet Explorer. However, scripts that rely on event delegation with the submit event will work consistently across browsers as 

Answered by hamnaacw
0

Answer:

I'm looking for a way to submit only changed form fields to the server. So, let's say I have a form which is populated with certain data already. The user edits the form and clicks submit. If the user only changed input b, then I want to submit only input b. If only a and c were changed, I want to submit only a and c. And so on.

I could write something myself to accomplish this, but I am wondering maybe there is already something out there that I could use? Ideally, I would like the code to be short.  

please mark it brainiest if it is helpful

Explanation:

Similar questions