Is there a way to fill in all the data from a specific form? let's say something like this:
<form id="unique00"> <input type="text" name="whatever" id="whatever" value="whatever" /> <div> <input type="checkbox" name="whatever" id="whatever" value="whatever" /> </div> <table><tr><td> <input type="hidden" name="whatever" id="whatever" value="whatever" /> <input type="submit" value="qweqsac" /> </td></tr></table> </form> <form id="unique01"> <div> <input type="text" name="whatever" id="whatever" value="whatever" /> <input type="checkbox" name="whatever" id="whatever" value="whatever" /> </div> <table><tr><td> <input type="hidden" name="whatever" id="whatever" value="whatever" /> </td></tr></table> <select>blah...</select> <input type="submit" value="qweqsac" /> </form> etc forms... forms...
* Note: each form may have a different input size and type, as well as a different HTML structure
so is there a way to populate input from a specific form id? for example, if I click the Submit button from a specific form identifier, then jquery will fill for me the entire input within that form identifier. I am currently doing it like this:
$("form").submit(function(){ return validateForm($(this)) }); function validateForm(form){ var retVal = true; var re; $.each(form.serializeArray(), function(i, field) { var input = $('input[name='+field.name+']'); field.value = $.trim(field.value); switch(field.name){ case "name" : and another cases... } }) }
it was work, but in this case I only get field.name and field.value, and actually what I want, I want a jquery object for each input element, so I can access their css, id, name and even animate this input element
is there any way for this?
please let me know well in advance! AND
javascript jquery html
AnD Nov 27 '10 at 9:47 2010-11-27 09:47
source share