I want to wrap words in <p>
tag into <span>
tags using .append()
and then target the <span>
tags via:
jQuery(document).ready(function() {
jQuery('.editable span').bind("mousedown", function() {
// do stuff to <span> tags...
});
});
But it doesn't work. As far as I know, $(document).ready()
just listen to newly added elements, right? What am I doing wrong?
For testing, here is a jsFiddle. As you can see, the jQuery('.editable span')...
part isn't being triggered when you click on the span tags.