JavaScript Remove unchanged input fields from Form while submit

In my web application I have edit profile page. In editprofile page their is many fields like

Name            : <input type="text" name="name"/>
Location        : <input type="text" class="geolocation" name="location">
Birthdata       : <input type="date" name="dob">
Profile Picture : <input type="file" name="photo"/>

I want to send back the data of only the fields which are edited and not all the fields.

Answer:1

I'd normally do something like this on the backend.... but for your requirement you could remove the inputs that haven't changed. When you generate the html you can define an extra data attribute. Here's how I would do that:

HTML:

<form id="myform">
    <input type="text" id="Name" data-initial="Foo" value="Foo" />
    <input type="text" id="Location" data-initial="Bar" value="Bar" />
    <input type="submit" value="Submit" />
</form>

JS:

$("#myform").submit( function() {
    $(this).find("input").filter( function() {
        $this = $(this);
        return $this.data("initial") == $this.val();
    }).remove();
});

http://jsfiddle.net/uLe7T/
I added an alert in the fiddle so you can see that they are removed before the form is submitted

Answer:2

After hacking away with DOM and event propagation issues all day I've come to the last of issues i've been trying to deal with using the marker clusterer. Currently I'm attaching a click handler to ...

After hacking away with DOM and event propagation issues all day I've come to the last of issues i've been trying to deal with using the marker clusterer. Currently I'm attaching a click handler to ...

  1. google maps marker icons
  2. google maps marker color
  3. google maps marker label
  4. google maps marker size
  5. google maps marker api
  6. google maps marker cluster
  7. google maps marker icon size
  8. google maps marker title
  9. google maps marker options
  10. google maps marker label position
  11. google maps marker tooltip
  12. google maps marker svg
  13. google maps marker click event
  14. google maps marker infowindow
  15. google maps marker images
  16. google maps marker events
  17. google maps marker style
  18. google maps marker hover
  19. google maps marker text
  20. google maps marker url

need "whitelist" object to look like this: { a: { b: { c: '' } } } apply to: { a: { b: { c: 1 } d: 2 e: 3 } } ...

need "whitelist" object to look like this: { a: { b: { c: '' } } } apply to: { a: { b: { c: 1 } d: 2 e: 3 } } ...

Is there a way in either JavaScript or C# to find a user's location by their IP address without querying a third party's API?

Is there a way in either JavaScript or C# to find a user's location by their IP address without querying a third party's API?

  1. find location address
  2. find location address mobile number
  3. find address location on map
  4. find my location address
  5. find location ip address
  6. find location ip address google maps
  7. find location mac address
  8. find current location address
  9. find location email address
  10. find location using address
  11. find location by address in bing map
  12. find my location address right now
  13. find your location address
  14. find home location address
  15. find location ip address python
  16. find location using ip address
  17. find location through ip address
  18. find my current location address
  19. find ip address location on map
  20. find location via ip address

A solar monitoring system generates a page at http://68.37.209.78:8050/ with live performance data. I want to scrape and parse this data, pass the PHP variables to JavaScript variables, which I can ...

A solar monitoring system generates a page at http://68.37.209.78:8050/ with live performance data. I want to scrape and parse this data, pass the PHP variables to JavaScript variables, which I can ...

  1. loading data from s3 to redshift
  2. loading data from excel to sql server
  3. loading data from s3 to snowflake
  4. loading data from csv python
  5. loading data from excel to matlab
  6. loading data from excel to r
  7. loading data from s3 to dynamodb
  8. loading data from a package in r
  9. loading data from excel into r
  10. loading data from s3 to aurora
  11. loading data from s3 into redshift
  12. loading data from emr to redshift
  13. loading data from oracle to snowflake
  14. loading data from hdfs to hive
  15. loading data from audio device bmw
  16. loading data from excel to oracle table
  17. loading data from s3 to redshift using lambda
  18. loading data from xml to database
  19. loading data from cloud storage to bigquery
  20. loading data from hdfs to hive table