in web application have edit profile page. in editprofile page many fields
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 send data of fields edited , not fields.
i'd on backend.... requirement remove inputs haven't changed. when generate html can define data attribute. here's how 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/
added alert in fiddle can see removed before form submitted
Comments
Post a Comment