Filter Elements Having Particular Class Using Jquery

Posted By : Gaurav Arora | 31-Mar-2016

Hi, In this blog I'm going to show that how to filter html tags having particular classes and after that applying new styles to that tag by adding some other class using Jquery. Suppose we have structure like this:


 
  • List Item
  • List Item
  • List Item
  • List Item
  • List Item

And We have to filter out the list items which are having list class on them. So, in this case we will use this as follow:

$(document).ready(function(){
    $(li).filter(".list").addClass("listing");
});
 

And after filtering that class we can add any styles to the new class listing that we had added. In this way we can filter elements using Jquery.

About Author

Author Image
Gaurav Arora

Gaurav is an experienced UI developer with experience and capabilities to build compelling UI's for Web and Mobile Applications.

Request for Proposal

Name is required

Comment is required

Sending message..