0

Jquery on click event is not working on dynamically added Custom tags

My code is

  $("[addtoShip='yes']").on('click', function() {
         alert('Ship added')
  });

Href for <a href="#" addtoShip='yes' myVal="10235">add more to Ship</a>

I am trying using .on But still it's not working

4
  • 4
    may be $(document).on('click', "[addtoShip='yes']", function() { Commented May 12, 2015 at 7:23
  • 1
    possible duplicate of stackoverflow.com/questions/203198/… Commented May 12, 2015 at 7:24
  • @BrijeshBhatt, I have tested that also but no luck Commented May 12, 2015 at 7:26
  • Ask a new question and paste some more code into that .. try to be specific.. add your html and script code where you are adding the dynamic element. @MangeshSatheIND Commented May 12, 2015 at 7:30

1 Answer 1

1
$(document/CommonParentSelector).on('click', "[addtoShip='yes']", function () {
    alert('Ship added')
});
Sign up to request clarification or add additional context in comments.

1 Comment

It Worked $(document).on('click', "[densitybtn='yes']", function() {}) But i did'nt get CommonParentSelector

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.