javascript - JQuery Wildcard ID Selector With Class -
i need create jquery selector select elements id starting newinstruction
, class of .individualinstruction
.
this should match divs id newinstruction0
, newinstruction1
, etc.
i can separately this:
$('[id^="newinstruction"]')
and
$('.individualinstruction')
however, i'm getting syntax errors when try combine them. simple, there jquery guru out there can point out did wrong?
combine them no space like
$('[id^="newinstruction"].individualinstruction')
document.write($('[id^="newinstruction"].individualinstruction').length);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> <div id="newinstruction1" class="individualinstruction"></div> <div id="newinstruction2" class="individualinstruction"></div> <div id="newinstruction3" class="individualinstruction"></div>
Comments
Post a Comment