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);
Sam Deering is a Front-end Web Developer who specialises in JavaScript & jQuery. Sam is driven and passionate about sharing his knowledge to educate others.

Free Guide:

How to Choose the Right Charting Library for Your Application

How do you make sure that the charting library you choose has everything you need? Sign up to receive this detailed guide from FusionCharts, which explores all the factors you need to consider before making the decision.

No Reader comments

Special Offer
Free course!

Git into it! Bonus course Introduction to Git is yours when you take up a free 14 day SitePoint Premium trial.