J-query interview questions and answer:-
What is Jquery?
jQuery is a JavaScript Library.
Which of the following is correct?
jQuery is a JavaScript Library
jQuery is a JSON Library
Answer :jQuery is a JavaScript Library
jQuery uses CSS selectors and XPath expressions to select elements?
False
True
Answer: True
Which sign does jQuery use as a shortcut for jQuery?
$ sign
% sign
? Sign
Answer: $ sign
Is jQuery a W3C standard?
Yes
No
Answer: NO
$("span"). What does it select?
All span elements
The first span element
Answer: All span elements
Is jQuery a library for client scripting or server scripting?
Client scripting
Server scripting
Answer: Client scripting
Is it possible to use jQuery together with AJAX?
Yes
No
Answer: Yes
The jQuery html() method works for both HTML and XML documents
True
False
Answer :False
jQuery code to set the background color of all span elements to blue?
$("span").style("background-color","blue");
$("span").manipulate("background-color","blue");
$("span").css("background-color","blue");
$("span").layout("background-color","blue");
Answer: $("span").css("background-color","blue");
$("span.intro"). What does it select?
The first span element with class="intro"
The first span element with id="intro"
All span elements with id="intro"
All span elements with class="intro"
Answer: All span elements with class="intro"
jQuery method to hide selected elements?
visible(false)
hidden()
display(none)
hide()
Answer: hide()
jQuery method to set one or more style properties for selected elements?
style()
css()
html()
Answer: css()
jQuery method is used to perform an asynchronous HTTP request?
jQuery.ajaxAsync()
jQuery.ajaxSetup()
jQuery.ajax()
Answer: jQuery.ajax()
What scripting language is jQuery written in?
VBScript
C++
JavaScript
C#
Answer: JavaScript
$("div#id1 .cl1"). What does it select?
The first element with id="cl1" inside any div element with class="id1"
All elements with class="cl1" inside the first div element with id="id1"
All div elements with id="id1" or class="cl1"
Answer: All elements with class="cl1" inside the first div element with id="id1"
Difference between onload() and document.ready() function used in jQuery?
jQuery is a JavaScript Library.
Which of the following is correct?
jQuery is a JavaScript Library
jQuery is a JSON Library
Answer :jQuery is a JavaScript Library
jQuery uses CSS selectors and XPath expressions to select elements?
False
True
Answer: True
Which sign does jQuery use as a shortcut for jQuery?
$ sign
% sign
? Sign
Answer: $ sign
Is jQuery a W3C standard?
Yes
No
Answer: NO
$("span"). What does it select?
All span elements
The first span element
Answer: All span elements
Is jQuery a library for client scripting or server scripting?
Client scripting
Server scripting
Answer: Client scripting
Is it possible to use jQuery together with AJAX?
Yes
No
Answer: Yes
The jQuery html() method works for both HTML and XML documents
True
False
Answer :False
jQuery code to set the background color of all span elements to blue?
$("span").style("background-color","blue");
$("span").manipulate("background-color","blue");
$("span").css("background-color","blue");
$("span").layout("background-color","blue");
Answer: $("span").css("background-color","blue");
$("span.intro"). What does it select?
The first span element with class="intro"
The first span element with id="intro"
All span elements with id="intro"
All span elements with class="intro"
Answer: All span elements with class="intro"
jQuery method to hide selected elements?
visible(false)
hidden()
display(none)
hide()
Answer: hide()
jQuery method to set one or more style properties for selected elements?
style()
css()
html()
Answer: css()
jQuery method is used to perform an asynchronous HTTP request?
jQuery.ajaxAsync()
jQuery.ajaxSetup()
jQuery.ajax()
Answer: jQuery.ajax()
What scripting language is jQuery written in?
VBScript
C++
JavaScript
C#
Answer: JavaScript
$("div#id1 .cl1"). What does it select?
The first element with id="cl1" inside any div element with class="id1"
All elements with class="cl1" inside the first div element with id="id1"
All div elements with id="id1" or class="cl1"
Answer: All elements with class="cl1" inside the first div element with id="id1"
Difference between onload() and document.ready() function used in jQuery?
- We can add more than one document.ready() function in a page.
- we can have only one onload function.
- Document.ready() function is called as soon as DOM is loaded.
- body.onload() function is called when everything (DOM, images..)gets loaded on the page.
JQuery Methods used to provide effects?
1. Show()
2. Hide()
3. Toggle()
4. FadeIn()
5. FadeOut()
What are the different type of selectors in Jquery?
1. CSS Selector
2. XPath Selector
3. Custom Selector
What does .size() method of jquery return ?
.size() method of jquery returns number of element in the object.
How do you get the text value?
$("#textbox1").val();
How do you check or uncheck a checkbox input or radio button?
1.$('#num1').attr('checked', true);// Check #num1
2.$('#num1').attr('checked', false);// Uncheck #num1
3.$("#num1").attr('checked', 'checked');// Check #num1
4.$("#num1").removeAttr('checked');// Uncheck #num1
Ajax Request in Jquery
$.ajax({
url: 'test.php',
success: function(response) {
alert(response);
},
error: function(res) {
alert(res.status);
}
});
Explain the each() function.
$("#num").click(function(){
$("li").each(function(){
document.write($(this).text())
});
});
0 comments:
Post a Comment