Timepicker:Uncaught TypeError:undefined不是函数

时间:2014-04-11 12:38:03

标签: javascript jquery ruby-on-rails twitter-bootstrap

我有一些插件:https://github.com/jdewit/bootstrap-timepicker

//= require jquery
//= require jquery_ujs
//= require bootstrap-datepicker/js/bootstrap-datepicker
//= require bootstrap-timepicker/js/bootstrap-timepicker
//= require admin/fileupload
//= require admin/category
//= require admin/cars
//= require admin/restaurants
//= require admin/events
//= require zipcodes

在admin / events.js中:

$(document).ready(function(){
  $('.timepicker').timepicker();
});

我收到了这个错误: 未捕获的TypeError:undefined不是函数

有人能帮助我吗?

编辑:

这是我用console.log($)得到的:

function ( selector, context ) {
        // The jQuery object is actually just the init constructor 'enhanced'
        // Need init if jQuery is called (just allow error to be thrown if not included)
        return new jQuery.fn.init( selector, context );
    } VM13723:2
undefined

1 个答案:

答案 0 :(得分:0)

我遇到了这个问题,我已经解决了这个问题:
首先,您需要通过NuGet packege管理器安装jQuery UI 如果您还没有搜索如何向ASP.NET MVC添加" jQuery UI"
1-转到" http://www.sitepoint.com/10-jquery-time-picker-plugins/"    并选择其中一个时间选择器 2-下载软件包(右键单击js和css文件并选择    "另存为链接") 3-拖放"(timepicker js文件的名称).js"在脚本中    项目解决方案资源管理器中的文件夹 4-拖放"(timepicker css文件的名称).css"在脚本中    项目解决方案资源管理器中的content \ themes \ base \文件夹 5-转到" BundleConfig"并添加(timepicker js文件的名称).js到 你的"〜/ bundles / jqueryui"和ether add(timepicker css文件的名称).css to"〜/ Content / themes / base / css"
我希望它适合你

相关问题