How to add class to particular li with anchor tag?

Accore LTD

this is very simple thing.I know and i am always using this type of thing. Now in my one project I am facing problem add class.

bellow is just HTML example:

//html
<div>
    <ul>
        <li><a href="#waxing" class="st_tab">Waxing</a></li>
        <li><a href="#hair-design" class="st_tab">Hair Design</a></li>
        <li><a href="#chemical-services" class="st_tab">Chemical Services</a></li>
    </ul>
</div>

js

$("ul li a:nth-child(1)").addClass("st_first_tab");

see this http://jsfiddle.net/QbN7c/1/ but it's working fine i use like this

$("ul li:nth-child(1)").addClass("st_first_tab"); 

i mean with out a tag.

Manish Kumar

Does this work?

$("ul li:nth-child(1)").find('a:first').addClass("st_first_tab");

fiddle

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to make particular Li tag active on click on anchor tag inside of that li tag?

From Dev

How to make particular Li tag active on click on anchor tag inside of that li tag?

From Dev

How to find anchor tag in div and add class?

From Dev

How to add a class to the image tag within anchor tag on hover?

From Dev

How to add an active class to an anchor tag based on URL and Vanity URLs?

From Dev

Add class to li tag on click

From Dev

How to add an anchor tag to a URL in a String

From Dev

how to check the active class of anchor tag in jquery?

From Dev

how to add a css class to a list when the particular li is clicked using jquery?

From Dev

how to add a css class to a list when the particular li is clicked using jquery?

From Dev

If child has an active class, add class to before anchor tag

From Dev

add class to all the anchor tag which have same file extention

From Dev

hide just the content of anchor tag and add class on media query

From Dev

Add span with class tag after the li tag in yii framework

From Dev

How to add Class to ul li

From Dev

How to add class after scrolling past anchor?

From Dev

How to add "li" to "ul" tag with C#

From Dev

How do i wrap a <li></li> around each anchor tag dynamically?

From Dev

How to add a class/id for particular node

From Dev

How to add data to the anchor tag in HTML and access it using jQuery?

From Dev

How to add a h3 and p to an anchor tag

From Dev

HTML: how to add anchor tag without effecting visual display?

From Dev

How to add Anchor tag on every database entery using codeigniter

From Dev

How to add class for body tag

From Dev

How to add a class to html tag?

From Dev

how to change an anchor tag using jquery by selecting its class

From Dev

Add a class tag to "the changable content DIV of the chosen <li>"

From Dev

Add CSS class to dynamic ul li a tag using javascript

From Dev

How to select a particular tab from other page using anchor tag in JQuery?

Related Related

  1. 1

    How to make particular Li tag active on click on anchor tag inside of that li tag?

  2. 2

    How to make particular Li tag active on click on anchor tag inside of that li tag?

  3. 3

    How to find anchor tag in div and add class?

  4. 4

    How to add a class to the image tag within anchor tag on hover?

  5. 5

    How to add an active class to an anchor tag based on URL and Vanity URLs?

  6. 6

    Add class to li tag on click

  7. 7

    How to add an anchor tag to a URL in a String

  8. 8

    how to check the active class of anchor tag in jquery?

  9. 9

    how to add a css class to a list when the particular li is clicked using jquery?

  10. 10

    how to add a css class to a list when the particular li is clicked using jquery?

  11. 11

    If child has an active class, add class to before anchor tag

  12. 12

    add class to all the anchor tag which have same file extention

  13. 13

    hide just the content of anchor tag and add class on media query

  14. 14

    Add span with class tag after the li tag in yii framework

  15. 15

    How to add Class to ul li

  16. 16

    How to add class after scrolling past anchor?

  17. 17

    How to add "li" to "ul" tag with C#

  18. 18

    How do i wrap a <li></li> around each anchor tag dynamically?

  19. 19

    How to add a class/id for particular node

  20. 20

    How to add data to the anchor tag in HTML and access it using jQuery?

  21. 21

    How to add a h3 and p to an anchor tag

  22. 22

    HTML: how to add anchor tag without effecting visual display?

  23. 23

    How to add Anchor tag on every database entery using codeigniter

  24. 24

    How to add class for body tag

  25. 25

    How to add a class to html tag?

  26. 26

    how to change an anchor tag using jquery by selecting its class

  27. 27

    Add a class tag to "the changable content DIV of the chosen <li>"

  28. 28

    Add CSS class to dynamic ul li a tag using javascript

  29. 29

    How to select a particular tab from other page using anchor tag in JQuery?

HotTag

Archive