+ 3
Jquerry
What is the purpose of jquerry? Hie does it help in building webpagesband how should it be used?
5 Réponses
+ 4
html:
<div style="background-color:green;width:50px;height:50px;transition:1s"></div>
js:
$("div").css("width","200px");//<div> will be instantly changed that is my answer .-.
+ 3
1. Jquery produces shorter and more compact code.
compare js
document.getElementById("myid").style.color = "red";
jquery
$("myid").css("color", "red");
Another example is ajax
$("#target").click(function(){
$.get("www.sololearn.com");
})
try doing this in js and you will probably end up with like 20 lines of code or more
2. It makes traversal(element selection and manipulation) extremely easy and intuitive.
$("div img:first") //this selects the first image under <div> element
3. Also you don't have to worry about browser or compatibility issues, all these are handled by jquery.
4. It also provides some features that aren't easily achievable in js e.g $.proxy which allows you to determine "this" which is even more powerful than js "apply", "bind" and "call"
So all this considered, it saves you a lot of time during writing and debugging.
But it is essential you understand javascript itself, it would help you utilize or maybe even improve jquery (plugin) and any other library or framework you intend to use in the future.
+ 2
visit jquery.com and take a look at the example and the documentation. also take a look at jQueryUI and jQuery mobile.
you'll find that it's much easier to use than to do it on your own in JavaScript.
+ 1
jQuery is Mainly used because of Security Purpose ie in Banking Software or Website. It also can used similar as JavaScript, Conviniently!!
+ 1
JQuery is a javascript library. The idea behind it is to "do more, code less" meaning consolidated functions have been created to help developers achieve more functionality quicker. For example, where you'd normally code line or line an animating function, JQuery now does that with one function call, you just give it parameters like time interval.