1

I have a backbone jquery mobile app in which i want to use mobiscroll date picker. I tried include it in the head tag.

TypeError: Cannot read property 'widget' of undefined 

But i am getting this error.

Is mobiscroll require js compatible ? How can i load it to use it within my views directly ?

Himanshu Soni
  • 264
  • 8
  • 15

2 Answers2

0

Make sure you're including Mobi Pick's JS file after Jquery Mobile.

I'm new to jQuery Mobile and realized I did that mistake just now. This solved it for me.

Telmo Marques
  • 5,066
  • 1
  • 24
  • 34
0

Just include mobiscroll the same way you include jquery and set the dependency on jquery. I'm posting here an example how you can include mobiscroll with require.js:

require.config({
    paths: {
      jquery: 'vendor/jquery/jquery.min'
      mobiscroll: 'vendor/mobiscroll/mobiscroll..min'
    },
    shim: {
       jquery:{
          exports: "jquery"
       },
       mobiscroll:{
          deps: ['jquery'],
          exports: "mobiscroll"
       }
    }
});
require(['domReady','app', 'mobiscroll'],
   function(domReady, App){
   ...
});
Danny
  • 13
  • 1
  • 4