试图使用 jQuery 在悬停时设置光标指针:
$('#example td').hover(function() {
$(this).css('cursor','pointer');
});
我不想把它放在CSS中,我想放在Jquery里。
我需要做什么来解决这个问题?
试图使用 jQuery 在悬停时设置光标指针:
$('#example td').hover(function() {
$(this).css('cursor','pointer');
});
我不想把它放在CSS中,我想放在Jquery里。
我需要做什么来解决这个问题?
$(document).ready(function() {
$('#example tr').click(function() {
var href = $(this).find("a").attr("href");
if(href) {
window.location = href;
}
});
$('#example tr').hover(function() {
$(this).css('cursor','pointer');
});
});
$('#example td').css('cursor', 'pointer');`
没有理由要指定悬停时应用的样式。光标只有在悬停时才会出现。
示例:http://jsfiddle.net/Egttj/15/
我假设你只是对在样式表中简单指定相应规则感到有些困难。但是,正如大家所指出的那样,这确实是最好和最简单的方法。
$('#example tr').hover(function() {
$(this).css('cursor','pointer');
});
$('#example td').css('cursor', 'pointer');`
$('#example tr').hover(function() {
$(this).css('cursor','pointer');
$(this).click(function() {
var href = $(this).find("a").attr("href");
if(href) {
window.location = href;
}
});
});