jQuery Interview Questions Part 2
6. Why is jQuery's data method use?Answer:
The jQuery's data method is used to associate the data with the DOM nodes and the objects.
Using this method, it helps to make your code more concise and clean.
You can call the data method on a jQuery object, or you can use the $.data() function instead.
// Using the data method:
// Using the data function:
8. What do you know about jQuery UI?Answer:
jQuery UI is a collection of visual effects, widgets, themes, user interface interactions implemented with jQuery, CSS and HTML.
jQuery UI is useful when you're building highly interactive web applications or you just need to add a date picker to a form control, jQuery UI is the perfect choice.
It is a powerful theme mechanism, stable and maintenance friendly and has extensive browser support.
9. Which methods are used to provide effects in jQuery?Answer:
jQuery provides various amazing effects. Following are the methods used to provide effects in jQuery,
1. animate( params, [duration, easing, callback] ): This function makes custom animations for your HTML elements.
2. fadeIn( speed, [callback] ): This function fades in all the matched elements by adjusting their opacity and firing an optional callback after completion.
3. fadeOut( speed, [callback] ): This function is used to fade out all the matched elements by adjusting their opacity to 0, then setting the display to "none" and firing an optional callback after completion.
4. fadeTo( speed, opacity, callback ): This function fade the opacity of all the matched elements to a specified opacity and firing an optional callback after completion.
5. stop( [clearQueue, gotoEnd ]): This function stops all the currently running animations.
6. Hide(): The hide() method hides each set of matched elements if shown.
7. Toggle() : This method toggles the elements. It toggles the display state of elements between revealed and hidden.
8. Show(): This method shows each of the matched elements if hidden.
10. What are the features of jQuery?Answer:
jQuery provides Document Object Model (DOM) which helps to select DOM elements, traverse them and modifying their content by using cross-browser open source selector engine.
jQuery offers event handling which helps to capture a wide variety of events, such as a user clicking on a link, without the need to clutter the HTML code itself with event handlers.
jQuery helps you to develop a responsive and feature-rich site using AJAX technology.
jQuery comes with plenty of built-in animation effects which you can use in your websites.
jQuery is very lightweight library - about 19KB in size ( Minified and gzipped ).
jQuery has cross-browser support, and works well in Internet Explorer 6.0+, FireFox 2.0+, Safari 3.0+, Chrome and Opera 9.0+
jQuery supports CSS3 selectors and basic XPath syntax.