I have a subclass element (.myclass) that is added after the DOM is initially loaded and there may be several on the page.
I have an on-click to detect the clicking of the class like this:
- <div id="wrapper">
- <span class="myclass">Click Here</span>
- </div>
The jQuery:
- $('#wrapper').on('click', '.myclass', function() {
- console.log('Inside');
- var target = $(this).find('#wrapper .myclass');
- console.log('TargetThis: ' , target);
- });
How do you target the class element that was just clicked. Currently it just gives me undefined.