Code Snippet
Check if Checkbox is Checked
Say that 10 times fast =).
Find out if a single checkbox is checked or not, returns true or false:
$('#checkBox').attr('checked');Find all checked checkboxes:
$('input[type=checkbox]:checked');Say that 10 times fast =).
Find out if a single checkbox is checked or not, returns true or false:
$('#checkBox').attr('checked');Find all checked checkboxes:
$('input[type=checkbox]:checked');
$(“input[type='checkbox']:checked”).each(function(){
// your code
});
What if a radio button is selected?
@gabBerg: $(“input:radio:checked”)
@Voigtan Thx!
The website is horrible in IE6. At least the design for the page should be made differently to work in IE6
Why are you still using IE6?
Agree with mahen23.
Also, I think css-tricks’ viewers are mostly web developers – In this case, (I hope) they don’t use IE6 as their default browser..
Bit late reaction, but hey maybe someone will find it usefull. You can also use
$('#checkBox').is(':checked')
DigWP
A book and blog co-authored by Jeff Starr and myself about the World's most popular publishing platform.
Quotes on Design
Design, like Art, can be an elusive word to define and an awfully fun thing to have opinions about.
HTML-Ipsum
One-click copy to clipboard access to Lorem Ipsum text that comes wrapped in a variety of HTML.
Bookshelf
Hey Chris, what books do you recommend? These, young fertile mind, these.