【发布时间】:2015-04-20 10:33:45
【问题描述】:
我们如何才能像使用任何其他选择器(即:id、类、输入等)一样使用 bodyelement 中的所有 texts 作为选择器?当正文中的任何文本被悬停或单击时,我想做一些事情。
例子:
$("body > text").on('mouseover', function(){
alert("Any text in the body is hovered!");
});
我试过了:
$("body").text().on('mouseover', function(){
alert("Any text in the body is hovered!");
});
但它返回此错误:
TypeError: $(...).text(...).on is not a function
【问题讨论】:
标签: javascript jquery html text typeerror