JQuery descriptive and hands-on suggestions - IDB-BISEW
Descriptive Answers
1. What is the function of jQuery?
Ans: jQuery is a new kind of JavaScript Library. It does perform so many different functions such as HTML document traversing, event handling, animating e.t.c.
2. What are the three building blocks for selecting element used in jQuery?
Ans: Three building blocks while selection elements in a given document:
A)Tag Name
Tag ID
C) Tag Class
3. Write the functions of hasClass and html methods.
Ans: hasClass(class): Returns true if the specified class is present on at least one of the set of matched elements.
Html(): Get the html contents (innerHTML) of the first matched element.
4. Which methods are used to add content before and inside of every matched element?
Ans: before(content) method is used to add content before each of the matched element.
appendTo(Seloctor) method is used to inside append all of the matched elements to another, seicified set of element.
5. What is the function of serializeArray() method?
Ans: serializeArray() method is a useful function for getting values of the elements. This function turns all the elements into a JavaScript object. Given example below….
Var data = $(‘form:first’).serializeArray();
6. Write the differences between load and get methods.
Ans: Both methods are similar expect for the fact that $.load is a method, which means it acts on a set of elements specified by a selector, On the other hand $.get is global method that has an explicity defined callback function.
7. What is the purpose of using ajaxError() method?
Ans: The ajaxError() method will be execute every time there is an error in AJAX request.
Example given below….
$(‘#result’).ajaxError(function()
{
$(this).html(‘<span>An error occurred.</span>’);
})
8. Which requests are cached by the browser?
Ans: jQuery.aja
): Perform an asynchronous HTTP (Ajax) request.
jQuery.getScript(): Load a JavaScript file from the server using a GET HTTP request, then execute it.
9. What is jQuery selector?
Ans: A JQuery selector is a function which makes use of expressions to find out matching elements from a DOM based on the given criteria.
10. Write examples for bind and unbind events for any element.
Answer: Unbind():Remove a previously-attached event handler from the elements.
Bind():Attach a handler to an event for the elements.
11. Explain the parameters of show method?
Answer: .show( [duration] [, easing] [, callback] )
Duration : A string or number determining how long the animation will run.
Easing : A string indicating which easing function to use for the transition.
Callback : A function to call once the animation is complete.
Evidence Questions
1 Create a database named ‘IDB’ and create two tables named Batch (ID,Round) and Student(ID, name, Course, Round).
Create a form with two dropdown list. One to display round data from Batch table and another table to display student name based on selected round using jQuery.
2 Create an html file with a div using fixed height, width and color. Change the div color after the regular interval using jQuery.
Comments 1