This is my code:
$('p').delegate('*', 'click', function () {
console.log('You have clicked on the paragraph.');
});
Please see http://jsfiddle.net/pzP4Q/8/ for a working example.
The problem I am having is that, although I would have set .delegate() to catch all clicks on my paragraphs, it doesn’t seem to catch clicks on text nodes.
How can I have .delegate() catch click events on text nodes?
In the case that it’s really the ‘p’ that you want to listen for clicks on, it’s just a matter of identifying an appropriate ancestor element. Usually this is a wrapper div, but it could be the body if need be: