/ Published in: jQuery
                    
                                        
Just so I remember the next time..
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
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>
Comments
 Subscribe to comments
                    Subscribe to comments
                
                