Reputation: 5411
I know how to choose a element using the Attribute Equals Selector [name="value"] but I feeling a little lost when I try to find a check box by his name and value.
this is a example of the checkbox
<input id="check-box-nat-Español" name="kid[native_languages][]" type="checkbox" value="50f97f5304fec25b00000001">
I have a lot of checkbox with the same name, so I need to find the checkbox using the name and the value.
I'm trying this, but it did not work.
$("input[name="kid[native_languages][]"][value=50f97f5304fec25b00000001]").attr("checked",true);
Any help please!
Upvotes: 0
Views: 67
Reputation: 1249
$("input[name='kid[native_languages][]'][value=50f97f5304fec25b00000001]").prop("checked",true);
Upvotes: 0
Reputation: 82231
You have error while selecting. You should use:
$("input[name='kid[native_languages][]'][value='50f97f5304fec25b00000001']").attr("checked",true)
Upvotes: 1
Reputation: 1343
Use single quotes around your selector so that they wont interfere with the ones inside
$('input[name="kid[native_languages][]"][value=50f97f5304fec25b00000001]')
Upvotes: 0