0

I have a button of class 'add' which, when clicked simply clones itself and its other div siblings. The cloning works fine, however the click functionality only works on the first instance of the button (the one that loads with the page) and not on any subsequent instances.

Any help would be great.

$('.add').click(function(){
        cloneDiv();
    });

1 Answer 1

2

Use the live method for dynamically added elements:

$('.add').live('click', function(){
    // your code...
});
Sign up to request clarification or add additional context in comments.

1 Comment

Super fast and spot on. At the risk of looking like eBay feedback... AAA++++++

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.