Select an element with multiple classes jQuery

Select an element with multiple classes jQuery

CSS Classes, as we know are the main drivers in the UI. Since we have only one id per element, our arena or tweak on that area is almost limited.
But classes are possible to be deployed multiple times per element and we can apply independent actions per classes..
Now, when you have two classes assigned and you want to single out that element having two classes in jQuery you would do

$('.class1.class2')

Without any space in between.
Common usage would be with javascript where you would take and put classes based on actions.

Yup!

spring upload multiple files

Add batch/multiple posts to Facebook Page – Graph API

Check if Function Exists in Javascript

jQuery Select Option from Json

pass all the jars in classpath when compiling java

how to get user input and process it in nodejs tutorial

2 Comments
  1. Sourav Basak

    For an intersection, just put the selectors together without spaces in between them. So, for an element that has an ID of a with classes b and c, you would write:

    $(“#a.b.c”)

    or

    $(“.a”).filter(“.b”)

    Get details:

    http://www.namasteui.com/select-element-with-multiple-classes/

    1. gullele

      Thanks Sourav for sharing the snippet and, of course, stopping by :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*