Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need to include jQuery core alongside jQuery mobile?

Is it necessary to include the core of jQuery, or is the mobile framework sufficient alone? From what I`ve tried, I concluded that both files are necessary, but I would like to be sure on this issue.

like image 253
Udi Idan Avatar asked Nov 07 '10 21:11

Udi Idan


People also ask

Do I need jQuery for jQuery Mobile?

jQuery Mobile, however, is a full framework. It's intended to be your starting point for a mobile site. It requires jQuery and makes use of features of both jQuery and jQueryUI to provide both UI components and API features for building mobile-friendly sites.

What is the difference between jQuery and jQuery Mobile?

jQuery is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML. On the other hand, jQuery Mobile is detailed as "Touch-Optimized Web Framework for Smartphones & Tablets".

Do people still use jQuery Mobile?

The deprecation of jQuery mobile follows the careful transition of another project under the jQuery project umbrella, jQuery UI. jQuery Core is still actively maintained and widely implemented.

How can I use jQuery Mobile?

JQuery Mobile is a user interface framework, built on jQuery Core and used for developing responsive websites or applications that are accessible on mobile, tablet, and desktop devices. It uses features of both jQuery and jQueryUI to provide API features for mobile web applications.


2 Answers

The docs give you all the information you need to know:

A jQuery Mobile site must start with an HTML5 'doctype' to take full advantage of all of the framework's features. (Older devices with browsers that don't understand HTML5 will safely ignore the 'doctype' and various custom attributes.) In the 'head', references to jQuery, jQuery Mobile and the mobile theme CSS are all required to start things off.

In short, yes, jQuery core is required.

like image 163
Andy E Avatar answered Nov 11 '22 03:11

Andy E


http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.js

Based on the code, it doesn't redefine jQuery but extends it so yes, you need the core.

(function( jQuery, window, undefined ) {  })( jQuery, this ); 

It passes the jQuery object when defining jQuery.mobile. See the demo which includes core before mobile.

like image 20
meder omuraliev Avatar answered Nov 11 '22 03:11

meder omuraliev