Reputation: 3816
I have a bunch of ids for radio buttons on my page:
id="scores_0" id="scores_1" etc etc.. I am new to jquery and wonder if there is a way to like select anything that sort of matches that.
$("#scores_*").css("border", "2px none black")
etc ?
or do i have to dynamically regex it somehow?
Upvotes: 0
Views: 45
Reputation: 2653
Try the below
$('input[id^=scores_]'); //^= StartsWith
$('input[id*=scores_]'); //*= Contains
Upvotes: 4
Reputation: 33661
Read here about jQuery selectors http://api.jquery.com/category/selectors/
$('[id^=scores_]') // <-- this selects all id starting with scores_
Upvotes: 2