21).Write the code for setting datetimepicker
on textbox click.
If below is our textbox
<input type="text" id="abc" name=%26quot%3Bacc%26quot%3B value="Select Date" />
then Jquery code will be
$("#abc").datepicker();
22).If you have a table, how you will apply the two differt color on alternate rows using Jquery?
If below is our textbox
<input type="text" id="abc" name=%26quot%3Bacc%26quot%3B value="Select Date" />
then Jquery code will be
$("#abc").datepicker();
22).If you have a table, how you will apply the two differt color on alternate rows using Jquery?
Code:
<table
border="1">
<tr><td>Vikas Ahlawat</td></tr>
<tr><td>Edwin George</td></tr>
<tr><td>Rohit Khurana</td></tr>
<tr><td>Gyan Singh</td></tr>
</table>
Ans :
<script src="jquery.js"></script>
<script>
$(document).ready(function()
{
$("tr:even").css("background-color", "#f4f4f8");
$("tr:odd").css("background-color", "#ffffff");
});
</script>
<tr><td>Vikas Ahlawat</td></tr>
<tr><td>Edwin George</td></tr>
<tr><td>Rohit Khurana</td></tr>
<tr><td>Gyan Singh</td></tr>
</table>
Ans :
<script src="jquery.js"></script>
<script>
$(document).ready(function()
{
$("tr:even").css("background-color", "#f4f4f8");
$("tr:odd").css("background-color", "#ffffff");
});
</script>
23).Name the Jquery method which is used to hide selected elements?
Ans: .hide()
24).Name the Jquery methods which are used for apply css class?
Ans:
$("#Id1").addClass('YourClassName'); // for apply class
$("#Id1").removeClass('YourClassName'); // for remove class
25).What is the use of attr() method in Jquery?
The attr() method sets or returns attributes and values of the selected elements.
When this method is used to return the attribute value, it returns the value of the first matched element.
When this method is used to set attribute values, it sets one or more attribute/value pairs for the set of matched elements.
Code:
$(selector).attr(attribute)
//it will return the value of an attribute
$(selector).attr(attribute,value) //it will set the value of an attribute
$(selector).attr({attribute:value, attribute:value,...}) //for set multiple attribute
$(selector).attr(attribute,value) //it will set the value of an attribute
$(selector).attr({attribute:value, attribute:value,...}) //for set multiple attribute
26).Can we use both jQuery and AJAX together?
Ans: yes
27).Tell the name of jQuery method which is used to perform an asynchronous HTTP request?
Ans: jQuery.ajax()
28).What is the use of jquery load() method?
The jQuery load() method is a powerful AJAX method.
The load() method loads data from a server and puts the returned data into the selected element without reload the complate page.
Ex:The following example loads the content of the file "demo_test.txt" into a specific <div> element
$("#div1").load("demo_test.txt");
29).Can we use our own specific charactor in the place of $ sigh in Jquery?
Ans: Yes
You can also create your own shortcut very easily. The noConflict() method returns a reference to jQuery, that you can save in a variable, for later use. Here is an example:
Code:
var
vikas = $.noConflict();
vikas(document).ready(function(){
vikas("button").click(function(){
vikas("p").text("jQuery is still working!");
});
});
vikas(document).ready(function(){
vikas("button").click(function(){
vikas("p").text("jQuery is still working!");
});
});
30).Name the 5 Jquery events?
Ans:-
jQuery Events
jQuery click() event.
jQuery dblclick() event.
jQuery mouseenter() event.
jQuery mouseleave() event.
jQuery mousedown() event.
jQuery mouseup() event.
jQuery hover() event.
jQuery focus() and blur() events.

No comments:
Post a Comment