Quick tip: Using CSS Classes as Basis for jQuery Selectors

Sam Deering

Quick tip: Using CSS Classes as Basis for jQuery Selectors

This quick tip will allow you to use CSS classes to group DOM elements which require the same function event binding. This will allow you to have as many links as you wish anywhere you just include the class prefix on the element.

//select the end of class
$('#div [id$=_popup]').css('z-index',9999);

//select the beginning of class
$('#div [id^=popup_]').css('z-index',-9999);

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

No Reader comments

Comments on this post are closed.