santa
santa

Reputation: 12512

Check if first radio button w/jQuery

If i build a list of items with radiobuttons next to them, how do I check the first one by default?

Upvotes: 0

Views: 517

Answers (2)

Whetstone
Whetstone

Reputation: 1199

$(".radio_identifier:first").prop('checked', 'checked');

Upvotes: 5

Andrew
Andrew

Reputation: 13853

<input type="radio" name="group1" value="a" checked>

Simply include the checked attribute.

Or through jQuery,

$("#groupids:first").prop('checked', 'checked');

Upvotes: 6

Related Questions