Examples of usage of jQuery selector
1. Select all elements
$("*")
2. Select the current HTML element
$(this)
3. Selects all <p> elements with class="intro"
$("p.intro")
4. Selects the first <p> element
$("p:first")
5. Selects the first <li> element of the first <ul>
$("ul li:first")
6. Selects the first <li> element of every <ul>
$("ul li:first-child")
7. Selects all elements with an href attribute
$("[href]")
8. Selects all <a> elements with a target attribute value equal to "_blank"
$("a[target='_blank']")
9. Selects all <a> elements with a target attribute value NOT equal to "_blank"
$("a[target!='_blank']")
10. Selects all <button> elements and <input> elements of type="button"
$(":button")
11. Selects all even <tr> elements
$("tr:even")
12. Selects all odd <tr> elements
$("tr:odd")
No comments:
Post a Comment
Note: only a member of this blog may post a comment.