jQuery Interview Questions and Answers
Q. What is jQuery?
Ans. jQuery is a JavaScript library and this build on JavaScript language. jQuery more easy to use then JavaScript and it use for front-end development that is more lightweight then other scripting language.

Q. What are selectors and how many types of selectors in jQuery?
Ans. In jQuery $ is a selector that is special key of jQuery and type of selectors are- Tags Name, Id and Class

$(‘tag_name’)
$(‘#id’)
$(‘.class’)

Q. Types Of AJAX in jQuery?
Ans. In jQuery AJAX will use in a four a way such as $.ajax(), $.post(), $.get() and .load()
Syntax-
$(‘#selector’).load(URL,data,callback);

$.ajax(function(){
type:”get”,
url:”URL”,
data:{“key”:value},
datatype:”JSON”
success:function(){

},
error:function(){

}
});

Q. Can we have multiple document.ready() function on the same page?
Ans. Yes we can use multiple document.ready function on same page.

Q. The use of jQuery .each() function?
Ans. In jQuery each() function is used for a iterate over both object and array. In term of array here i’m going write one example such as-

$.each([ 10, 20], function( indexKey, value ) {
    alert( indexKey + ": " + value );
});

And next example here i’m going to write for an object such as

var obj = {
"name": "ram",
"age": "22"
};
$.each( obj, function( object_key, object_value ) {
   alert( object_key + ": " + object_value );
});
Q. Different between .Text() and .Html() in jQuery?
Ans. Unlike the .html() method, .text() can be used in both XML and HTML documents and .html() function is only a wrapper to .innerHTML, but .text() function jQuery adds an “entity filter”, and this filter naturally consumes time that means .text() faster then .html().
News Reporter
IT Software and web development, Core PHP, JavaScript, JQuery, HTML, CSS, CakePHP, Angularjs, Codeigniter etc.

Leave a Reply

Your email address will not be published. Required fields are marked *

error: