The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript addClass to an appended LI element

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #33657

    Hi folks,

    I’m trying to add a class to a LI element which is appended later on.
    This is my JS:

    As you can see there’s a UL with class tabs, if you click on a


    there’s a new LI added to that UL.
    Which works fine, if you click on a LI which was in the UL by default, the JS is adding the class to it, but unfortunately not on the added LI.

    Can someone help me out?


    Thanks, didn’t know about the .live element!


    You should actually use delegate() instead of live(). As far as I can remember, delegate() is like liveV2.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.