Home » » JQUERY INTERVIEW QUESTIONS AND ANSWERS Module -2

JQUERY INTERVIEW QUESTIONS AND ANSWERS Module -2

11).Where Jquery code execute? On client browser or server browser?
On client browser

12).Write the code for selecting the
1st div element, 4th div element
last div, and for even and odd div elemets also.
one by one?

apply the red color on the above div.
Code:
<div class="questions">
        <div class="box"> Question</div>
    <div class="box"> Question</div>
    <div class="box"> Question</div>
    <div class="box"> Question</div>
    <div class="box"> Question</div>
    <div class="box"> Question</div>
</div>
Code for first div       : $("div.questions > div:first").css("color", "red");
Code for 4th div         : $("div.questions > div:nth-child(4)").css("color", "red");
Code for last div        : $("div.questions > div:last").css("color", "red");
Code for even div        : $("div.questions > div:even").css("color", "red");
Code for odd div         : $("div.questions > div:odd").css("color", "red");

13).Write the code for select second last div element?
Code for second last div : $("div.questions > div::nth-last-child(2)").css("color", "red"); <!-- Introduced in CSS3 -->

14).What are the advantages of using jQuery over JavaScript in ASP.NET web application 
Ans:
Below are the advatages of using jQery over JavaScript
a>.Jquery is well written optimised javascript code so
it will be faster in execution unless we write same standard optimised javascript code.
b>.Jquery is concise java script code ,means minimal ammount of code
is to be written for the same functionality than the javascript.
c>.Javascript related Development is fast using Jquery because most of the
functionality is already written in the library and we just need to use that.
d>.Jquery has cross browser support ,so we save time for supporting all the browsers.


15).What is Chaining in jQuery?
Ans:
In jQuery, Chaining means to connect multiple functions, events on selectors. look at Sample Code 1 and 2.
Code:
Sample Code 1
​$(document).ready(function(){
    $('#dvContent').addClass('dummy');
    $('#dvContent').css('color', 'red');
    $('#dvContent').fadeIn('slow');
});​

Sample Code 2 (using Chaining)
​$(document).ready(function(){
    $('#dvContent').addClass('dummy')
          .css('color', 'red')
          .fadeIn('slow');     
});​
Both the sample codes above will perform the exact same thing but the only difference is that Sample code 2 is using Chaining. But Code 2 is faster and shorter then Code 1.
The problem with the Sample Code 1 is that for every statement, jQuery has to search the entire DOM and find the element and after that executes the attached function on it. But when chaining is used, then jQuery has to find the element only once and it will execute all the attached functions one by one. This is the advantage of Chaining.
For read more click on the below link
http://jquerybyexample.blogspot.com/2012...query.html
http://tobiasahlin.com/blog/quick-guide-...in-jquery/

16).Is jQuery a library for client scripting or server scripting?
Ans: Client Script

17).What is jQuery & its significance? Why it is so popular?...


18).What are features of JQuery 
or
 
What can be done using JQuery?

Features of Jquery
1. One can easily provide effects and can do animations.
2. Applying / Changing CSS.
3. Cool plugins.
4. Ajax support
5. DOM selection events
6. Event Handling


19).How to check Jquery UI loaded or not?
Ans: // Checking if jQuery UI is loaded or not
Code:
if($.ui){
    // jQuery UI is loaded
}else {
    // jQuery UI is not loaded
}

20).How check currently loaded jQuery UI version on the page?
Ans: // Returns jQuery UI version (ex: 1.8.2) or undefined
$.ui.version


0 comments:

Post a Comment