控制我的 tabcontainer 的 Jquery 脚本给出了“预期对象”运行时错误。 老实说,我找不到原因:
$(document).ready(function() {
//When page loads...
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active ID content
return false;
});
});
与样式表有关吗?
最佳答案
我想你想删除你var
来自选择器
activeTab.fadeIn(); //Fade in the active ID content
如果您遇到错误@ $(document).ready(function() {
记得包含 jQuery 脚本。
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
关于c# - Jquery 运行时错误 : object expected,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2716203/