dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online MembersPawan Awasthi
Asheej T K
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Resources » .NET programming » General

JQuery Selectors


Posted Date:     Category: General    
Author: Member Level: Gold    Points: 10


jQuery selectors allow you to select HTML elements (or groups of elements) by element name, attribute name or by content.



 


jQuery Selectors



Till now we have learnt how to select different HTML elements. It is a key point to learn how jQuery selects exactly the elements you want to apply an effect to.
Note: jQuery selectors allow you to select HTML elements (or groups of elements) by element name, attribute name or by content.

jQuery Element Selectors


jQuery uses CSS selectors to select HTML elements.
$("p") selects all

elements.
$("p.intro") selects all

elements with class="intro".
$("p#demo") selects all

elements with id="demo".

jQuery Attribute Selectors


jQuery uses XPath expressions to select elements with given attributes.
$("[href]") select all elements with an href attribute.
$("[href='#']") select all elements with an href value equal to "#".
$("[href!='#']") select all elements with an href attribute NOT equal to "#".
$("[href$='.jpg']") select all elements with an href attribute that ends with ".jpg".

jQuery CSS Selectors


jQuery CSS selectors can be used to change CSS properties for HTML elements.
The following example changes the background-color of all p elements to red:
$("p").css("background-color","red");





Did you like this resource? Share it with your friends and show your love!


Responses to "JQuery Selectors"

No responses found. Be the first to respond...

Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: Introduction to Windows Azure.
    Previous Resource: Methods in HTTP request
    Return to Resources
    Post New Resource
    Category: General


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    JQuery  .  Meetu choudhary  .  Jquery selector  .  



    Follow us on Twitter: https://twitter.com/dotnetspider

    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.