Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all! We have been experiencing an issue on site where threads have been missing the latest postings. The platform host Vanilla are working on this issue. A workaround that has been used by some is to navigate back a page or two to re-sync the thread and this will then show latest posts. Thanks, Mike.

jquery selector help

  • 04-03-2009 8:52pm
    #1
    Registered Users, Registered Users 2 Posts: 872 ✭✭✭


    Hi,

    I have a menu like
    <ul id="nav">
    <li><a href="#">one</a><li>
    <li><a href="#">two</a><li>
    <li><a href="#">three</a><li>
    <li><a href="#">four</a><li>
    </ul>
    

    I need to select the fourth a tag and add extra css to it
    $("#nav > li:nth-child(4) > a").css("width:90px");
    

    i think the > a part is causing issues because if i remove it the css gets added to the 4th li item.

    Thanks for any help


Comments

  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    grahamor wrote: »
    Hi,

    I have a menu like
    <ul id="nav">
    <li><a href="#">one</a><li>
    <li><a href="#">two</a><li>
    <li><a href="#">three</a><li>
    <li><a href="#">four</a><li>
    </ul>
    

    I need to select the fourth a tag and add extra css to it
    $("#nav > li:nth-child(4) > a").css("width:90px");
    

    i think the > a part is causing issues because if i remove it the css gets added to the 4th li item.

    Thanks for any help

    Firstly, I can't see any reason for either ">"

    Secondly, if removing the ">" works, why do you need help ?


  • Registered Users, Registered Users 2 Posts: 8,070 ✭✭✭Placebo


    eh use

    .find()

    and then use .append for your forth tag


  • Registered Users, Registered Users 2 Posts: 872 ✭✭✭grahamor


    it was just a syntax error
    $("#primary-nav > li:nth-child(7) > a").css[B]({width:"90px"});[/B]
    

    instead of
    $("#primary-nav > li:nth-child(7) > a").css[B]("width:90px");[/B]
    

    Thanks anyway


Advertisement