Forums

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

Home Forums JavaScript .add help!

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #30292
    GreatPotato
    Member

    Ok i’m trying to add a span into a p element with jquery…

    The p is always the second from last p in the form….

    $(".add").click(function() {
    $("form > p:nth-child(2)").clone(true).insertBefore("form > p:last-child(-1)");
    $("form > p:last-child(-1)").add('Remove').inserBefore("form > p:last-child(-1)");
    });

    Basically I clone the form that exists and then add a “remove” span to the end of it (which will be used to remove the form)… Cloning the form is fine but I can’t add the remove span!

    This is what I have so far but it doesn’t seem to work and it’s giving me a headache any help?

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