jQuery Mobile

  Home  Client Side Scripting  jQuery Mobile


“jQuery Mobile frequently Asked Questions in various jQuery Mobile job Interviews by interviewer. The set of questions here ensures that you offer a perfect answer posed to you. So get preparation for your new job hunting”



77 JQuery Mobile Questions And Answers

1⟩ Why we need jQuery Mobile?

jQuery Mobile is a touch-optimized web framework (additionally known as a JavaScript library or a mobile framework) currently being developed by the jQuery project team. The development focuses on creating a framework compatible with a wide variety of smartphones and tablet computers, made necessary by the growing but heterogeneous tablet and smartphone market. The jQuery Mobile framework is compatible with other mobile app frameworks and platforms such as PhoneGap, Worklight and more.

 210 views

2⟩ How to divide a page into parts using jQuery Mobile?

Pages normally don't have a fixed height.

If you set a page or some element on a page to a fixed height using CSS, then you can size things in terms of %.

You'll need to use a bit of Javascript to set the page height.

Here's one way to get the device height:

var viewportHeight = document.documentElement.clientHeight;

Here's another (that I haven't tried, but should work) because jQuery Mobile sets the device height as min-height CSS for the page. (And assuming you already have a $page variable with the page.)

var viewportHeight = parseFloat($page.css('min-height'));

Then, you can:

$page.height(viewportHeight + 'px');

 213 views

3⟩ Explain CDN?

A content delivery network or content distribution network (CDN) is a large distributed system of servers deployed in multiple data centers across the Internet. The goal of a CDN is to serve content to end-users with high availability and high performance.

 208 views

5⟩ Explain why there are two different version of jQuery library?

The production version is quite useful at development time as jQuery is open source and if you want to change something then you can make those changes in production version. But the deployment version is minified version or compressed version so it is impossible to make changes in it. Because it is compressed, so its size is very less than the production version which affects the page load time.

 203 views

6⟩ Can you please explain the difference between prop and attr?

► attr():

Get the value of an attribute for the first element in the set of matched elements. Whereas,.prop(): (Introduced in jQuery 1.6) Get the value of a property for the first element in the set of matched elements.

► Attributes carry additional information about an HTML element and come in name="value" pairs. Where Property is a representation of an attribute in the HTML DOM tree. once the browser parse your HTML code ,corresponding DOM node will be created which is an object thus having properties.

► attr() gives you the value of element as it was defines in the html on page load. It is always recommended to use prop() to get values of elements which is modified via javascript/jquery , as it gives you the original value of an element's current state.

 213 views

7⟩ Explain .delegate()?

The .delegate() method behaves in a similar fashion to the .live() method, but instead of attaching the selector/event information to the document, you can choose where it is anchored and it also supports chaining.

 226 views

8⟩ Can you please explain the difference between body onload() and document.ready() function?

Document.ready() function is different from body onload() function for 2 reasons.

► We can have more than one document.ready() function in a page where we can have only one body onload function.

► Document.ready() function is called as soon as DOM is loaded where body.onload() function is called when everything gets loaded on the page that includes DOM, images and all associated resources of the page.

 243 views

9⟩ Can you please explain the difference between .js and .min.js?

jQuery library comes in 2 different versions Production and Deployment. The deployment version is also known as minified version. So .min.js is basically the minified version of jQuery library file. Both the files are same as far as functionality is concerned. but .min.js is quite small in size so it loads quickly and saves bandwidth.

 218 views

11⟩ Explain jQuery.noConflict?

As other client side libraries like MooTools, Prototype can be used with jQuery and they also use $() as their global function and to define variables. This situation creates conflict as $() is used by jQuery and other library as their global function. To overcome from such situations, jQuery has introduced jQuery.noConflict().

jQuery.noConflict();

// Use jQuery via jQuery(...)

jQuery(document).ready(function(){

jQuery("div").hide();

});

 212 views

14⟩ Tell me what does dollar sign ($) means in jQuery?

Dollar Sign is nothing but it's an alias for JQuery. Take a look at below jQuery code.

► $(document).ready(function(){});

Over here $ sign can be replaced with "jQuery" keyword.

► jQuery(document).ready(function(){});

 217 views

19⟩ Why do we use jQuery?

Due to following advantages:

► Easy to use and learn.

► Easily expandable.

► Cross-browser support (IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+)

► Easy to use for DOM manipulation and traversal.

► Large pool of built in methods.

► AJAX Capabilities.

► Methods for changing or applying CSS, creating animations.

► Event detection and handling.

► Tons of plug-ins for all kind of needs.

 207 views

20⟩ Explain is jQuery replacement of Java Script?

No. jQuery is not a replacement of JavaScript. jQuery is a different library which is written on top of JavaScript. jQuery is a lightweight JavaScript library that emphasizes interaction between JavaScript and HTML.

 201 views