javascript - grabbing multiple types of tags in one jquery object -


this question has answer here:

from http://jqfundamentals.com/chapter/events, "in of our examples until now, we've been passing anonymous functions event handlers. however, can create function ahead of time , store in variable, pass variable event handler. useful if want use same handler different events or events on different elements."

$( 'li' ).on( 'click', handleclick ); $( 'h1' ).on( 'click', handleclick ); 

is there jquery li , h1 elements in 1 liner? interpret

$( 'h1 li' ).on( 'click', handleclick ); 

to mean "all li items inside of h1 items"

thank you

separate selectors commas.

$( 'h1, li' ).on( 'click', handleclick ); 

Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -