确定这里的变量是我的代码:jQuery的:作为ID选择不工作
$tabularID = 0;
$('a.swfselector').live('mouseover', function(event) {
$tabularID= $(this).parent().attr('id');
$(this).parent().children().not(this).find('.tab').each(function() {
$(this).fadeTo(100, 0.4)
})
$(this).find('.tab').each(function() {
$(this).fadeTo(100,1)
})
});
$('#' + $tabularID).live('mouseleave', function(event) {
alert($tabularID);
$(this).children().find('.tab').each(function() {
$(this).fadeTo(100,1)
})
});
Jquery的不喜欢这个选择:
$('#' + $tabularID)
虽然如果我将其更改为:
$('#27')
它警告我的变量$ tabularID就好了,所以我知道它不是错误的变量($ tabularID的输出是27)。我需要一个变量,因为父ID会根据它们的鼠标悬停而发生变化。
任何人都可以看到我不能?可能真的很明显。
不知道他们是否是你的问题的根源,但你不能用纯数字作为标识。用像a27'这样的字母作为前缀, – 2011-04-26 08:28:16
欢呼声,尽管这不能解决问题。这是什么原因? – 2011-04-26 08:30:06
规范;)http://www.w3.org/TR/html401/types.html#type-name虽然我认为在HTML5中是允许的。 – 2011-04-26 08:30:51