Find the parent element of each paragraph with a class "selected". : Selector « jQuery « JavaScript DHTML

JavaScript DHTML
1. Ajax Layer
2. Data Type
3. Date Time
4. Development
5. Document
6. Dojo toolkit
7. Event
8. Event onMethod
9. Ext JS
10. Form Control
11. GUI Components
12. HTML
13. Javascript Collections
14. Javascript Objects
15. Javascript Properties
16. jQuery
17. Language Basics
18. Mochkit
19. Mootools
20. Node Operation
21. Object Oriented
22. Page Components
23. Rico
24. Scriptaculous
25. Security
26. SmartClient
27. Style Layout
28. Table
29. Utilities
30. Window Browser
31. YUI Library
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
JavaScript DHTML » jQuery » Selector 
Find the parent element of each paragraph with a class "selected".
  



<html>
  <head>
    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("p").parent(".selected").css("background""yellow");

        });
    </script>
  </head>
  <body>
    <body>
          <div><p>Hello</p></div>
          <div class="selected"><p>Hello Again</p></div>
          
    </body>
</html>

   
    
  
Related examples in the same category
1. Adds class to all divs that have a paragraph inside of them.
2. Ancestor descendant
3. Assign query result to variable
4. Contains another tag
5. Contains(text) matches elements which contain the given text.
6. Count hidden tags
7. Doest it contain
8. Find all elements is to set the 'context' to document.body
9. Find all elements within the 'context' (document.body)
10. Find tag from just added HTML
11. Finds every element (including head, body, etc).
12. HTML contains
13. Hides all paragraphs then the link on click.
14. Make all visible divs turn yellow on click.
15. Matches all elements
16. Matches all elements that are headers, like h1, h2, h3 and so on
17. Matches all elements that have no children (including text nodes)
18. Matches all elements with the given name.htm
19. Matches all input elements of type text.htm
20. Matches elements which contain the given text
21. Methods to obtain new wrapped set based on relationships
22. Removes all elements that match "div p.selected" from the total set of all paragraphs.
23. Select more than one
24. Show hidden div tags
25. empty() matches all elements that have no children (including text nodes).
26. header() matches all elements that are headers, like h1, h2, h3 and so on.
27. hidden() matches all elements that are hidden, or input elements of type "hidden".
28. jQuery custom filter selectors
29. not(selector) filters out all elements matching the given selector.
30. visible() matches all elements that are visible.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.