I’ve got a very interesting need for jQuery.
I need to look into a specific DIV ID and then within that DIV, find an input thats name contains a certain string but is also checked.
var exclusionsFridayChecked = $("#divExclusions").find("input[id~='Fridays'][type='checked']").length;
// hoping to get '1' if it is checked
But that doesn’t work… my syntax is off.
The
~=selector “selects elements that have the specified attribute with a value containing a given word, delimited by spaces”.Since ids cannot contain spaces, I’m guessing that you want
*=, which “selects elements that have the specified attribute with a value containing the a given substring”.So, you can try using