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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -