Return to Snippet

Revision: 11456
at February 6, 2009 05:49 by stavelin


Initial Code
Radio button
js:
[$("input[@name='the_name']:checked").val()]

html:
<input type="radio" name="the_name" value="0" /> Milk
<input type="radio" name="the_name" value="1" /> Coffie

the_name is the name of several buttons, and it's the items value that is selected 


Same method on a textfield:

js:
[$('input[@name="newCatField"]').val()]

html:
<input type="text" id="newCatField" name="newCatField"/>
same same.

On a dropdown menu:

js:
$('#myid :selected').val()

html:
<select id="myid">
<option value="1">Nyhet</option>
<option value="2">Sport</option>
<option value="3">Utenriks</option>
</select>

Initial URL


Initial Description
Just so I remember the next time..

Initial Title
Select radiobuttons, textfields and dropdown menys with jquery

Initial Tags
jquery

Initial Language
jQuery