About JQuery
About JQuery
1
jQuery
•jQuery is a fast and concise JavaScript Library created by John Resig in 2006
with a nice motto − Write less, do more
DOM Manipulation.
Event Handling.
AJAX Support.
Animations.
Lightweight.
Cross Browser support.
Latest Technology.
Examples:
$(this).hide() - hides the current element.
$("p").hide() - hides all <p> elements.
$(".test").hide() - hides all elements with class="test".
$("#test").hide() - hides the element with id="test".
Concepts:
Functions.
Arguments.
Context.
Scope.
Callback.
Closures
Strings.
Numbers.
Booleans.
Arrays.
Objects.
typeOf.
Undefined.
Empty values.
Null.
Example
$(document).ready(function(){
Do something…
})
$(document) is a jQuery object. The$() is actually a function in disguise; it
turns the document into a jQuery object.
.ready() is a type of function; you can think of it as sort of a helper that runs
the code inside its parentheses as soon as the HTML document is ready.
function(){} is the action that.ready() will perform as soon as the HTML
document is loaded. (In the above example, the Do somethingplaceholder is
where those actions would go.)
jQuery traversing, which means "move through", are used to "find" (or select)
HTML elements based on their relation to other elements. Start with one
selection and move through that selection until you reach the elements you
desire.
jQuery provides a trivially simple interface for doing various kind of amazing
effects. jQuery methods allow us to quickly apply commonly used effects with
a minimum configuration.
Hide/Show
Fade
slide
animate
stop
callback
chaining
AJAX is an acronym standing for Asynchronous JavaScript and XML and this
technology help us to load data from the server without a browser page
refresh.
The load() method loads data from a server and puts the returned data into
the selected element.
The jQuery library supports nearly all of the selectors included in Cascading
Style Sheet (CSS) specifications 1 through 3, as outlined on the World Wide
Web Consortium's site.
Using JQuery library developers can enhance their websites without worrying
about browsers and their versions as long as the browsers have JavaScript
enabled.
Most of the JQuery CSS Methods do not modify the content of the jQuery
object and they are used to apply CSS properties on DOM elements.
Attr()
Html()
Val()
Removing DOM Elements
empty()
remove()
Inserting DOM Elements
after()
before()