Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Nov 2006
    Posts
    71
    Thanks
    12
    Thanked 0 Times in 0 Posts

    adding class to a .append element

    I'm working on this jquery menu and I have a conflicting element that I need to tie down with CSS. How can I add a class to an element that is inside .append?

    $("ul.subnav").parent().append("<span>");


    $("ul.subnav").parent().append("<span class='image'>"); (example of what I want)
    Last edited by Kor; 06-25-2010 at 01:38 PM. Reason: JQuery Title

  • #2
    Senior Coder
    Join Date
    Feb 2009
    Location
    Ilkley, West Yorkshire, UK
    Posts
    2,956
    Thanks
    9
    Thanked 727 Times in 721 Posts
    What you've got will work in FF, Chrome etc. For IE have a try with:

    Code:
    $("ul.subnav").parent().append("<span class='image'></span>");
    IE being a pain as usual.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •