What is the use of the animate() method in jQuery?
“The animate function is used to apply the custom animation effect to elements. Syntax:
$(selector).animate({params}, [duration], [easing], [callback])
Here,
“”param”” defines the CSS properties on which you want to apply the animation.
“”duration”” specify how long the animation run. It can be one of the following values: “”slow,”” “”fast,”” “”normal”” or milliseconds
“”easing”” is the string which specifies the function for the transition.
“”callback”” is the function which we want to run once the animation effect is complete.”
What is the difference between prop and attr?
“attr(): It gets the value of an attribute for the first element in the set of matched element.
prop(): it gets the value of a property for the first element in the set of matched elements. It is introduced in jQuery 1.6.”
Is jQuery a programming language?
jQuery is not a programming language but a well-written JavaScript code. It is used to traverse documents, event handling, Ajax interaction, and Animation.
jQuery Interview Questions
Is jQuery replacement of JavaScript?
No, jQuery is not the replacement of JavaScript. jQuery is written on the top of JavaScript, and it is a different library. jQuery is a lightweight JavaScript library which is used to interact with JavaScript and HTML.
Why do we use jQuery?
“It is very easy to learn and use.
It is used to develop browser compatible web applications.
It improves the performance of an application.
It is very fast and extensible.
It facilitates you to write minimal lines of codes for UI related functions.
It provides cross-browser support.
“
What is the use of toggle() method in jQuery?
“The jQuery toggle() is a particular type of method which is used to toggle between the hide() and show() method. It shows the hidden elements and hides the shown element.
Syntax:
$(selector).toggle();
$(selector).toggle(speed, callback);
$(selector).toggle(speed, easing, callback);
$(selector).toggle(display);
speed: It is an optional parameter. It specifies the speed of the delay. Its possible values are slow, fast and milliseconds.
easing: It specifies the easing function to be used for transition.
callback: It is also an optional parameter. It specifies the function to be called after completion of toggle() effect.
display: If true, it displays an element. If false, it hides the element.”
Advance jQuery Interview Questions
What is the purpose of fade Toggle() method in jQuery?
“The jQuery fade Toggle() method is used to toggle between the fadein() and fadeout() methods. If the elements are faded in, it makes them faded out, and if they are faded out, it makes them faded in.
Syntax:
$(selector).fade Toggle();
$(selector).fade Toggle(speed,callback);
$(selector).fade Toggle(speed, easing, callback);
speed: It is an optional parameter. It specifies the speed of the delay. Its possible values are slow, fast and milliseconds.
easing: It specifies the easing function to be used for transition.
callback: It is also an optional parameter. It specifies the function to be called after completion of fadeToggle() effect.”
What is the use of delay() method in jQuery?
“The jQuery delay() method is used to delay the execution of functions in the queue. It is the best method to make a delay between the queued jQuery effects. The jQuery delay () method sets a timer to delay the execution of the next item in the queue.
Syntax:
$(selector).delay (speed, queueName)
speed: It is an optional parameter. It specifies the speed of the delay. Its possible values are slow, fast and milliseconds.
queueName: It is also an optional parameter. It specifies the name of the queue. Its default value is “”fx”” the standard queue effect.”
Is it possible that jQuery HTML work for both HTML and XML document?
No, jQuery HTML only works for HTML document. It doesn’t work for XML documents.
jQuery Interview Questions
What is the use of html() method in jQuery?
“The jQuery html() method is used to change the entire content of the selected elements. It replaces the selected element content with new contents.
Syntax:
$(document).ready(function(){
$(“”button””).click(function(){
$(“”p””).html(“”Hello Javatpoint.com””);
});
}); “
What is the use of CSS() method in jQuery?
“The jQuery CSS() method is used to get (return)or set style properties or values for selected elements. It facilitates you to get one or more style properties. The jQuery CSS() provides two ways:
Return a CSS property
It is used to get the value of a specified CSS property.
$(document).ready(function(){
$(“”button””).click(function(){
alert(“”Background color = “” + $(“”p””).css(“”background-color””));
});
});
Set a CSS property
This property is used to set a specific value for all matched element.
$(document).ready(function(){
$(“”button””).click(function(){
$(“”p””).css(“”background-color””, “”violet””);
});
}); “
Is jQuery library used for server scripting or client scripting?
It is a library for client-side Scripting.
Advance jQuery Interview Questions
What is the starting point of code execution in jQuery?
$(document).ready() function is the starting point of jQuery code. It is executed when DOM is loaded.
What is the basic requirement to start with the jQuery?
You need refer to its library to start with jQuery. You can download the latest version of jQuery from jQuery.com.
Can you use any other name in place of $ (dollar sign) in jQuery?
“Yes, instead of $ (dollar sign) we can use jQuery as a function name. For example:
jQuery(document).ready(function() {
jQuery(“”p””).CSS(“”background-color””, “”pink””);
}); “
jQuery Interview Questions
Can you use multiple document.ready() function on the same page?
“Yes. You can use any number of document.ready() function on the same page. For example:
$(document).ready(function() {
$(“”h1″”).css(“”background-color””, “”red””);
});
$(document).ready(function() {
$(“”p””).css(“”background-color””, “”pink””);
}); “
How can you use a jQuery library in your project?
“You can use a jQuery library in the ASP .NET project from downloading the latest jQuery library from jQuery.com and include the references to the jQuery library file in your HTML/PHP/JSP/Aspx page.
What is the use of serialize() method in jQuery?
“The jQuery serialize() method is used to create a text string in standard URL-encoded notation. It serializes the form values so that its serialized values can be used in the URL query string while making an AJAX request.
Syntax:
$(document).ready(function(){
$(“”button””).click(function(){
$(“”div””).text($(“”form””).serialize());
});
}); “
Advance jQuery Interview Questions
What is the use of val() method in jQuery?
“The jQuery val() method is used:
To get the current value of the first element in the set of matched elements.
To set the value of every matched element.
Syntax:
$(document).ready(function(){
$(“”button””).click(function(){
$(“”div””).text($(“”form””).serialize());
});
}); “
How to use connect ?
“Download jQuery connect file from jQuery.com
Include that file in the HTML file.
Use $.connect function to connect a function to another function.”
In what scenarios jQuery can be used ?
“jQuery can be used in following scenarios:
Mainly for Animation effects
Manipulation purpose
Calling functions on events
Apply CSS static or dynamic”
jQuery Interview Questions
What are the effects methods used in jQuery?
” jQuery enables us to add effects on a web page. jQuery effects can be categorized into fading, sliding, hiding/showing, and animation effects. jQuery provides many methods for effects on a web page
These are the effects methods used in jQuery:
show() – It displays or shows the selected elements.
hide() – It hides the matched or selected elements.
toggle() – It shows or hides the matched elements. In other words, it toggles between the hide() and shows () methods.
fadeIn() – It shows the matched elements by fading it to opaque. In other words, it fades into the selected elements.
fadeOut() – It shows the matched elements by fading it to transparent. In other words, it fades out the selected elements. “
What does the jQuery Ajax event method Ajax Complete() do?
Whenever an Ajax request completes, jQuery triggers the Ajax Complete event. Any handlers that have been registered with the .Ajax Complete() method are executed at this time.
What does the jQuery ajax event method Ajax Start() do?
Whenever an Ajax request is about to be sent, jQuery checks whether there are any other outstanding Ajax requests. If none are in progress, jQuery triggers the Ajax Start event. Any and all handlers that have been registered with the .Ajax Start() method are executed at this time.
Advance jQuery Interview Questions
Whether jQuery HTML work for both HTML and XML documents?
No, jQuery HTML only works for HTML documents not for XML Documents.
What are the methods used to provide effects?
“Some of the effects methods are:
Show()
Hide()
Toggle()
Fade In() and
Fade Out()”
What is the advantage of using minimized version of jQuery?
Efficiency of web page increases when minimized version of jQuery is used.min.js file will be more than 50% less than the normal js file. Reduction in the file size makes the web page faster.
jQuery Interview Questions
Which operating system is more compatible with jQuery?
Mac, Windows and Linux are more compatible with the jQuery.
Which command will give a version of jQuery?
The command $.ui.version returns jQuery UI version.
In what scenarios jQuery can be used?
“jQuery can be used in following scenarios:
Apply CSS static or dynamic
Calling functions on events
Manipulation purpose
Mainly for Animation effects”
Advance jQuery Interview Questions
What are the types of selectors in jQuery?
“There are three types of selectors in jQuery:
CSS Selector
XPath Selector
Custom Selector”
Why jQuery is better than JavaScript?
jQuery is a library used for developing Ajax application and it helps to write the code clean and concise. It also handles events, animation and Ajax support applications.
What is the method used to define the specific character in place of $ sign?
‘No Conflict’ method is used to reference a jQuery and save it in a variable. That variable can be used instead of Sign.
jQuery Interview Questions
Where jQuery code is getting executed?
jQuery code is getting executed on a client browser.
What is the slowest selector in jQuery?
Class selectors are the slowest selectors in jQuery.
Which is the fastest selector in jQuery?
ID and Element are the fastest selectors in jQuery.
Advance jQuery Interview Questions
How method can be called inside code behind using jQuery?
$.ajax can be called and by declaring Web Method inside code behind using jQuery.
What is the use of jQuery each function?
jQuery each function is used to loop through each and every element of the target jQuery object. It is also useful for multi element DOM, looping arrays and object properties.
What is the difference between onload() and document.ready()?
In a page, we can have only one onload function but we can have more than one document.ready function. Document.ready function is called when DOM is loaded but onload function is called when DOM and images are loaded on the page.
jQuery Interview Questions
What is the use of jQuery. Data() method?
jQuery data method is used to associate data with DOM nodes and JavaScript objects. This method will make a code very concise and neat.
Whether C# code behind can be called from jQuery?
Yes, we can call C# code behind from jQuery.
What are all the ways to include jQuery in a page?
“Following are the ways to include jQuery in a page:
Local copy inside script tag
Remote copy of jQuery.com
Remote copy of Ajax API
Local copy of script manager control
Embedded script using client script object”
Advance jQuery Interview Questions
What is the use of jQuery. Ajax method ()?
jQuery. Ajax method is used for asynchronous HTTP requests.
Is jQuery is a replacement of JavaScript?
No, jQuery is not a replacement of JavaScript.
What is called chaining?
Chaining is used to connect multiple events and functions in a selector.
jQuery Interview Questions
How can we debug jQuery?
“There are two ways to debug jQuery:
Debugger keyword
Add the debugger to the line from where we have to start debugging and then run Visual Studio in Debug mode with F5 function key.
Insert a break point after attaching the process”
What is the script build up by jQuery?
jQuery is a Javascript file and it is single javascript file that contains common DOM, event effects and Ajax functions.
Is jQuery is a client or server scripting?
jQuery is a client scripting.
Advance jQuery Interview Questions
Which sign is used as a shortcut for jQuery?
Dollar ($) sign is used as a shortcut for jQuery.