JQuery is a framework
for writing javascript tasks in a easier way. JQuery it is written in
javascript. Also, I should mention that browsers parse only html and css files
as also js scripts. Hence, all javascript frameworks (jQuery, AngularJS, etc)
are written in javascript. They provide you the oportunity to write js code
easier but under the hook they are all written in javascript.
An example in order to
understand why JQuery is easier.
Say we have the
following input element
<input id="button1" type="button" value="clickMe"/>
Also say that we want when someone click on the button to have an alert box showing to the user a 'Hello' message.Then the code in javascipt would be:-
document.getElemementById("button1").addEventListener('click', function(){
alert("Hello");
});
});
Using JQuery the above
would be written as follows:
$('#button1').click(function()
{
alert("Hello");
});
{
alert("Hello");
});
Using JQuery makes
things more clear. (write less do more is jQuery's moto)
So jQuery is "Write Less,Do more"...
Happy Coding...
No comments:
Post a Comment