How we can use all texts
inside body
element as selector just like any other selectors (ie.: id, class, input, etc.)? I want to do something when any text in the body is hovered or clicked.
Example:
$("body > text").on('mouseover', function(){
alert("Any text in the body is hovered!");
});
I tried this:
$("body").text().on('mouseover', function(){
alert("Any text in the body is hovered!");
});
but it is returning this error:
TypeError: $(...).text(...).on is not a function