c# - Jquery 运行时错误 : object expected

标签 c# asp.net jquery

控制我的 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/

相关文章:

c# - 从文件系统中的字体加载家族(而不是字体)名称

c# - 格式化字符串的输出

javascript - 从 AJAX 调用的 PHP 排序数组不起作用

javascript - IonicFramework + AngularJS + 无法使用单击 HREF 根据列表中的选择呈现页面

jquery - TextArea 根据内容自动调整大小

c# - 错误 : Extension methods must be defined in a top level static class (CS1109)

c# - 增加 ReportViewer axd 处理程序的超时

c# - 如何将 List<string> 转换为 Sql In 语句的 SqlParameter?

c# - 必须在 (MVC3 + MVC4) 环境中打开 ASP.NET MVC3 项目

asp.net - 登录 OnClick 事件未触发