deepakabc
asked on
get value by name
how do i get value by name in jquery..
give example if u can ?
give example if u can ?
ASKER
inside form it's not working
i meanform tag
i meanform tag
Ahh.. Then, $(form.element).val();
e.g.
<form name="myform">
<input type="hidden" name="myinput" value="myvalue" />
</form>
$(myform.myinput).val() returns value.
e.g.
<form name="myform">
<input type="hidden" name="myinput" value="myvalue" />
</form>
$(myform.myinput).val() returns value.
ASKER
what i want... i want to specify name in it like
name = att1, name= att2, name=att3
then access all of them by for loop ....
name = att1, name= att2, name=att3
then access all of them by for loop ....
Could you please explain bit more?
Say form is like follow
<form name="myform">
<input type="hidden" name="food" value="eggs">
<input type="hidden" name="drink" value="beer">
</form>
Then you need?
Say form is like follow
<form name="myform">
<input type="hidden" name="food" value="eggs">
<input type="hidden" name="drink" value="beer">
</form>
Then you need?
ASKER
<form name="myform">
<input type="hidden" name="food1" value="eggs">
<input type="hidden" name="food2" value="beer">
<input type="hidden" name="food3" value="beer">
</form>
now i want to access all the name variable through for loop in jquery ...
for (i=0; i<3; i++)
{
get value food 1 and 2 and 3 here..
}
thanks
<input type="hidden" name="food1" value="eggs">
<input type="hidden" name="food2" value="beer">
<input type="hidden" name="food3" value="beer">
</form>
now i want to access all the name variable through for loop in jquery ...
for (i=0; i<3; i++)
{
get value food 1 and 2 and 3 here..
}
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<input type="hidden" name="myinput" value="myvalue" />
$(myinput).val() returns the value. No quotations.