嗨H与一些代码,带回一个链接的类名如何将#添加到VAR
var activeTab = $(this).attr("class");
因此,可以说上述带回“一”
我的价值需要提前
var activeTab = $(this).attr("class");
$(activeTab).stop(true, false).animate({ height: "200px" });
由于追加这是#one为下面的代码
嗨H与一些代码,带回一个链接的类名如何将#添加到VAR
var activeTab = $(this).attr("class");
因此,可以说上述带回“一”
我的价值需要提前
var activeTab = $(this).attr("class");
$(activeTab).stop(true, false).animate({ height: "200px" });
由于追加这是#one为下面的代码
您可以使用+操作字符串连接这样的:
$('#' + activeTab)
var activeTab = $(this).attr("class");
activeTab = '#' + activeTab;
$(activeTab).stop(true, false).animate({ height: "200px" });
很简单:
var_name = '#' + var_name;
您可以使用+字符串连接:
$('#' + activeTab)
$( '#' + activeTab)....
?!
var activeTab = $(this).attr("class");
$("#" + activeTab).stop(true, false).animate({ height: "200px" });
var activeTab = "#" + $(this).attr("class");
$(activeTab).stop(true, false).animate({ height: "200px" });
我认为这是你想要做什么。
为什么要添加第二行? – locrizak 2011-05-13 15:44:13
我在回答中明确表示。我同意,第二个例子在实际代码中并不一定需要。 – 2011-05-13 15:46:31