Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
What is Jquery?
Posted by: Virendradugar
JQuery is Java Script library or Java Script Framework which helps in how to traverse HTML documents page. It mainly helps programmer to reduce lines of code as huge code written in Java For http://bit.ly/v0QdsH detailed information,
che
aske
Dollar
Sign
is
nothing
but
it's
an
alias
for
JQuery.
$(document).ready(function(){ });
Over
here
sign
can
be
replace
jQuery(document).ready(function(){ });
aske
Document.ready()
function
is
different
from
body
onload()
1. We can have more than one document.ready() function in a page w 2. Document.ready() function is called as soon as DOM is loaded where body.onload() function is calle images and all associated resources Click below link to get mostly http://jquerybyexample.blogspot.com/2011/08/mostly-asked-jquery-interview-questions.html
aske
What are the steps you need to follow to use jQuery in ASP.Net project?
Posted by: Virendradugar
It's really simple. One just need to add reference of javascript file(.js). Go to Jquery.com and downlo
there
is
"jQuery-1.3.2.js"
in
the
to can be vary
go
depending
aske
JQuery See
UI below
is
library on
which this
is
built
on
top
of
JQuery control
library. used
JQuery in
UI
comes page
page
site.
Date
Picker
this
to
aske
Features 1. 2. 3. 4. 5. 6.
of One can Applying DOM Event easily provide / Cool Ajax effects
aske
Some 1. 2. 3. 4. 5.
of
the
common
Visit http://jquerybyexample.blogspot.com/
JQuery is replacement of Java Script?
my
Posted by: Virendradugar NOTE: This is objective type question, Please click question title for correct answer. What are the different type of selectors in Jquery? Posted by: Virendradugar There are 3 types of selectors in Jquery 1. CSS Selector 2. XPath Selector 3. Custom Selector Visit my blog. http://jquerybyexample.blogspot.com/ What are the advantages of JQuery ? Posted by: Chvrsri There are many advantages with JQuery. Some of them are : . It is more like a JavaScript enhancement so there is no overhead in learning a new syntax. . It has the ability to keep the code simple, readable, clear and reusable. . It would eradicate the requirement for writing complex loops and DOM scripting library calls. How can you select all elements in a page using jQuery? Posted by: Akiii To select all elements in a page, we can use all selectors, for that we need to use *(asterisk symbol). <script language="javascript" type="text/javascript"> $("*").css("border", "2px dotted red"); </script>
The above code will select all elements of the web page and apply border width as 2 pixel, style as dotted and color Thanks and Regards Akiii What is jQuery?
Posted by: SheoNarayan jQuery is not a language but it is a well written JavaScript code, As quoted on official jQuery website it is a fast and event handling, animating, and Ajax interactions for rapid web development. In order to work with jQuery you should be aware of basics of JavaScript, HTML and CSS. It was released in January 2006 at BarCamp NYC by John Resig. Licensing: It is free, open source software Dual-licensed under the MIT License and the GNU General Public License. Microsoft jQuery intellisense is available in Visual Studio 2010 now.
Why jQuery?
Posted by: Sheonarayan jQuery is very compact and well written JavaScript code that increases the productivity of the developer by enabling of code. It helps to # # # # # Improve the performance of the application Develop most browser compatible web page Implement UI related critical functionality without writing hundreds of lines of codes Fast Extensible jQuery can be extended to implement customized behavior
Other advantages of jQuery are # No need to learn fresh new syntax's to use jQuery, knowing simple JavaScript syntax is enough # Simple and Cleaner code, no need to write several lines of codes to achieve complex functionality. Where to download jQuery from? Posted by: Sheonarayan jQuery javascript file can be downloaded from jQuery Official website http://www.jquery.com/ How to use jQuery?
Posted by: Sheonarayan jQuery usually comes as a single JavaScript file containing everything comes out of the box with jQuery. It can be i To load local jQuery file <script type="text/javascript" src="jQuery-1.4.1-min.js"></script>
Ideally this markup is kept in under <head></head> tag of your web page, however you are free to keep anywher
What is jQuery? Latest answer: jQuery is a lightweight JavaScript library that emphasizes interaction between JavaScript and HTML.............
Read answer
Advantages of jQuery Latest answer: The advantages of using jQuery are: JavaScript enhancement without the overhead of learning new syntax............
Read answer
Extensibility.............
Read answer
Explain the concepts of "$ function" in jQuery with an example. Latest answer: The type of a function is "function". There are a lot of anonymous functions is jquery...............
Read answer
Why is jQuery better than javascript? Latest answer: jQuery is great library for developing ajax based application. It helps the programmers to keep code simple and concise and reusable..............
Read answer
Explain how jQuery Works. Latest answer: <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript">................
Read answer
When can you use jQuery? Latest answer: JQuery can be used to apply CSS call functions on events traverse the documents...................
Read answer
1) Select elements by tag name Example: $(div) It will select all the div elements in the document. 2) Select elements by ID Example: $(#xyzid) It will select single element that has an ID of xyzid 3) Select elements by class Example: $(.xyzclass) It will select all the elements having class xyzclass
In jQuery we have three methods to give the fade effect to elements: fadeIn, fadeOut and fadeTo
Syntax:
speed can be one of following values : slow, fast, normal or milliseconds opacity specify the value that allows the fading to given opacity. callback is the function which we want to run once the fading effect is complete.
param defines the CSS properties on which you want to apply the animation. duration specify how long the animation will run. It can be one of following values : slow, fast, normal or milliseconds easing is the string which specify the function for the transition. callback is the function which we want to run once the animation effect is complete.
For example <div id="clickToAnimate"> Click Me </div> <div id="mydiv" style=width:200px; height:300px; position: relative; right: 20px;"> </div> Following is the jQuery to animate opacity, left offset, and height of the mydiv element $('# clickToAnimate).click(function() { $('#book').animate({ opacity: 0.30, left: '+=20', height: 'toggle' }, 3000, function() { // run after the animation complete. }); });
For example <ul> <li> item 1 </li> <li id=second_item> item 2 </li> <li class=myitem> item 3 </li> <li class=myitem> item 4 </li> </ul> Now we want to find the siblings of the element of id second_item and change the text color to Blue : $(li.second_item).siblings().css(color,blue); If we want specific sibling elements for example the elements having class myitem then we can pass a optional selector: $(li.second_item).siblings(.myitem).css(color,blue);
The difference in .css(width) and .width() is the data type of value we specify or return from the both functions. In .css(width) we have to add px in the width value while in .width() we dont have to add. When you want to get the width of mydiv element then .css(width) will return 300px while .width() will return only integer value 300.
jQuery.data(span, item, { val1: 10, val2: "myitem" }); If we want to retrieve the data related to div element and set it to labels data: $("label:val1").text(jQuery.data(div, "item").val1); $("label:val2").text(jQuery.data(div, "item").val2);
index is the index position of the selector. selector specifies the current selector where we can use this selector also. In the case when we need to stop the each loop early then we can use return false;
For example $("#clickme").click(function(){ $("li").each(function(){ document.write($(this).text()) }); }); This will write the text for each li element.
duration is the number specifying how long the animation will run. easing is the string which specify the function for the transition. callback is the function which we want to run once the animation is complete. If the element is visible then this effect will slide the element up side and make it completely hidden. If the element is hidden then slideToggle() effect will slide it down side and make it visible. We can specify the toggle speed with this effect.
For example $("#clickme").click(function(){ $("#mydiv").slideToggle(slow, function(){ //run after the animation is complete. }); });
For example: personObj=new Object(); empObject.name="Arpit"; empObject.age="24"; empObject.dept=IT; $("#clickme").click(function(){ $("span").text($.param(empObject)); }); It will set the text of span to name=Arpit&age=24&dep=IT
$(document).ready(function(){ $('#mydiv').css('color', 'blue').addClass('myclass').fadeIn('fast'); }); -Advantage of chaining is that it makes your code simple and simple to manage. -The execution becomes faster because the code search for the element only once.
17) What is difference between sorting string array and sorting numerical array in jQuery?
The sort method is used to sort any array elements. It sorts the string elements alphabetically. For example $(document).ready(function(){ var mylist = [ Apple,Orange,Banana]; mylist = mylist.sort(); $(#mydiv).html(list.join()); }); It will give following output Apple Banana Orange Now we declare a numerical array and use sort() method to sort its elements. $(document).ready(function(){ var mylist = [ 20,3100,50]; mylist = mylist.sort(); $(#mydiv).html(list.join()); }); It will give following output 100 20 3 50
For example <input value="My Value" type="text"/> $('input').prop('value', 'Changed Value'); -.attr('value') will return 'My Value' -.prop('value') will return 'Changed Value'
<script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js> </script> Above code will always load the 1.5.1 version of jQuery. If you reference the latest jQuery then you dont need to change the code every time the new version of jQuery is released. To achieve this you have to use following code <script type=text/javascript src=http://code.jquery.com/jquery-latest.min.js> </script> This code will always reference the latest version of jQuery in your page.