Get input array values in JQuery

by Ramya 2011-08-31 17:08:27

Get input array values in JQuery

If you have stored array values in an input box using PHP and try to retrieve those array values using JQuery then use the following format,

$("input[name^=ar]").each(function() { //remove id attribute of an input box and replace it with name attribute
alert($(this).val());
});


Input box values will be like,
<?php
for($y=1;$y<sizeof($arr);$y++){
echo "<input type=text name=ar[] value='$arr[$y]'></input>";
}
?>

Tagged in:

1549
like
0
dislike
0
mail
flag

You must LOGIN to add comments