我需要获取表格的“td”元素。我无法将“moused”或onclick事件添加到“td”元素,因此我需要使用JQUERY添加它们。如何获得jQuery的表元素中的“td”?
我需要JQUERY将mouseover和onclick事件添加到表中的所有“td”元素。
这就是我需要的,也许有人可以帮助我?
我需要获取表格的“td”元素。我无法将“moused”或onclick事件添加到“td”元素,因此我需要使用JQUERY添加它们。如何获得jQuery的表元素中的“td”?
我需要JQUERY将mouseover和onclick事件添加到表中的所有“td”元素。
这就是我需要的,也许有人可以帮助我?
$(function() {
$("table#mytable td").mouseover(function() {
//The onmouseover code
}).click(function() {
//The onclick code
});
});
关闭下面的代码让你开始。它应该做你需要的。
$("td").hover(function(){
$(this).css("background","#0000ff");
},
function(){
$(this).css("background","#ffffff");
});
您可以使用this as a reference, which is where I pulled that code。