I just want the keyup even to work on child but not on parent, just showing as example below that it works on parent but not on child.
Here is my jQuery:
// This works
$('#editor').on('keyup change', function(){
console.log('keyup event works on Parent');
});
// This doesn't do anything
$('#editor').on('keyup change', '.js-selected-text', function(){
console.log('How to make keyup event work for child');
});
Here is my markup, and class for child js-selected-text
will be added dynamically, so I am using .on()
to bind.
<div id="editor" class="wysihtml5-editor" contenteditable="true">Lorem <span class="js-selected-text">Ipusum</span> dolo solo polo</div>