Targeting Checkbox/Radio that has been checked with JQuery

By: Ryan Wong at

I always forget how to target check box that has been checked when I need it most.

So I decided to make a blog post so I can get the answer really fast.

1
2
3
4
5
6
7
8
//find out selected value
var isChecked = $('#tag').is(':checked');

//get value
var getCheckedValue = $('#tag2:checked').val();

//target radio directly
var getRadioValue = $('#tag2 input[type="radio"][name="blah[]"]:checked').val();

Hope it helps.