Use of jQuery attribute filters

Using jQuery attribute filters make it easy to select and modify particular attributes in your html DOM


 
Ads

Use of jQuery attribute filters

     

Use of jQuery attribute filters

In this section you will learn how to use attribute filters of jQuery.

Using jQuery attribute filters make it easy to select and modify particular attributes in your html DOM. So, you can find the elements based on some query and then modify them to suit your application needs.

Given below is the demonstration how you can apply filters on attribute ,here we are using "a href " attribute of html DOM :

  • Using it , you can hide all the link in your html page as : $("a[href]").toggle();.
  • But if you want to hide one link , you can do it as : $("a[href='http://www.ai.com/']").toggle();
  • If you want to hide the link which has "google" in href.
  • You can also hide the links which ends with "org" as  $("a[href$='org']").toggle();
  • You can also hide the link which starts like " http://doc " as : $("a[href^='http://docs']").toggle();.

Learn from experts! Attend jQuery Training classes.

Advertisements

Ads
Share on Google+Share on Google+

Use of jQuery attribute filters

Posted on: September 15, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: Use of jQuery attribute filters  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
Zavrina
July 3, 2011
UbRqSdlUAUITDQKqKBu

Articles like this are an example of quick, helpful aswners.

Ads

 

Ads