javascript - Get Contents of form Element with Same Name in Jquery. Accessing Childeren of the Object -
javascript - Get Contents of form Element with Same Name in Jquery. Accessing Childeren of the Object -
i have form format
<form> <fieldset> <label for="select_label">enter label </label> <input type="text" class="text ui-widget-content ui-corner-all" id="select_label" name="select_label" gtbfieldid="307"> </fieldset> <fieldset> <label for="select_option">option</label> <input type="text" class="text ui-widget-content ui-corner-all" name="select_option" gtbfieldid="308"> </fieldset> <fieldset> <label for="select_option">option</label> <input type="text" class="text ui-widget-content ui-corner-all" value="1" name="select_option"> </fieldset> <fieldset> <label for="select_option">option</label> <input type="text" class="text ui-widget-content ui-corner-all" value="2" name="select_option"> </fieldset> <fieldset> <label for="select_option">option</label> <input type="text" class="text ui-widget-content ui-corner-all" value="3" name="select_option"> </fieldset> <fieldset> <label for="select_option">option</label> <input type="text" class="text ui-widget-content ui-corner-all" value="4" name="select_option"> </fieldset> <fieldset> <input type="button" value="add more option" id="add_more" name="add_more"> </fieldset>
and trying values of inputs name "select_option". have java script code loops number of times element occurs can`t value of
for(var i=0 ; i<$('input[name=select_option]').size(); i++) { alert(i); alert($('input[name=select_option]').children(i)); //alert($('input[name=select_option]').children()[0].find("input").val()); }
you can see above code , have commented out not work me. idea?
try
$('input[name=select_option]').each(function(){alert($(this).val())});
javascript jquery jquery-selectors
Comments
Post a Comment