0

I have a page with some logic. After clicking the button creates a div element. I'm need to remove class from this element. I'm know, how add evens to dynamic elements, but can't find, how change attribute of dynamic element..

<div class="one two">it's a div</div>
$('.one').removeClass('two'); // doesn't work

may be i'm need some like this: ?

$(document).on(...)

It's not duplicate!!! it's defferend questions. I'm don't need events!

1 Answers1

0

Use on function:

$('parent-selector').on('event', 'element-selector', function () {
    //the event triggered
});

When you need a event to be captured for dynamic elements.

For Eg: If you need a click event then you need to use on

Harikrishnan N
  • 874
  • 1
  • 10
  • 19