Check if a radio button is checked with jQuery
<form name="myForm">
<label>Birds<input name="myButton" type="radio" value="Birds" /></label>
<label>Dogs<input name="myButton" type="radio" value="Dogs" /></label>
<label>Cats<input name="myButton" type="radio" value="Cats" /></label>
<p style="color:red;"></p>
</form>
<script>
$('form[name=myForm] input[type=radio]').click(function() {
if($(this).is(':checked')) {
$(this).parent().parent().children('p').html($(this).val()+' are selected');
}
});
</script>
Example
Latest news
- - S5 Slide Show System: PowerPoint on Linux
- - µTorrent for Linux
- - Linux audio tagger
- - Gnome 3 release date - interview with Stormy Peters
- - Ubuntu Maverick Meerkat Beta Released
- - Ubuntu Maverick Meerkat frozen
- - Tab Candy for Firefox
- - Ubuntu font launched for beta testing
- - Interview with Richard Stallman
- - Linux Mint 9 KDE released
- - Gnome 3 release date delayed to march 2011