What is jQuery?

jQuery is a JavaScript library. It is a lightweight, “write less, do more”, JavaScript library.

The purpose of jQuery is to make it much easier to use JavaScript on your website.

jQuery takes a lot of common tasks that require many lines of JavaScript code to accomplish, and wraps them … Read more

.addBack() in jQuery

It helps to add the previous element on the stack to the current element, optionally filtered by a selector.

.addBack()

// HTML Content
<ul>
<li>item 1</li>
<li>item 2</li>
<li class=”third-item”>item 3</li>
<li>item 4</li>
<li>item 5</li>
</ul>

// To apply yellow from “item 4” to “item 5”
$( “li.third-item” ).nextAll().css( “background-color”,

Read more

.ajaxComplete() in jQuery

It Register a handler to be called when Ajax requests complete.

.ajaxComplete()

// To add a log and it will display when the ajax request completed.

$( document ).ajaxComplete(function() {
   $( “.log” ).text( “Triggered ajaxComplete handler.” );
});

Read more

.ajaxError() in jQuery

It helps to register a handler , to be called when Ajax requests complete with an error.

.ajaxError()

// an alert box will display , when an AJAX request fails

$( document ).ajaxError(function() {
alert(“An error occurred in Ajax action!”);
});

Read more

.ajaxSend() in jQuery

It helps to attach a function to be executed before an Ajax request is sent.

.ajaxSend()

// To add a log, when an AJAX requests is about to be sent. It will bind when requesting the ajax action.

$( document ).ajaxSend(function() {
    $( “.log” ).text( “Triggered ajaxSend handler.” );
});

Read more

.ajaxStop() in jQuery

It will execute when all Ajax requests have completed.

.ajaxStop()

// an alert box will display when all AJAX requests have completed

$(document).ajaxStart(function(){
    $(this).html(“< img src='demo_wait.gif' />“);
});

Read more