Home  >  jQuery

Example of deferred.done() in jQuery

April 30, 2013
deferred.done() adds handlers or functions and makes an ordered collection. All these handlers is called when deferred object is resolved. Syntax is
var def = $.Deferred();
def. resolve()
Find the example.

<!DOCTYPE html>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<button>Click To Test deferred.done()</button>

function fun1() {
 $("div").append(" You ");
function fun2() {
$("div").append(" are ");
function fun3(str) {
$("div").append(" on  " + str);
/* create a deferred object */
var def = $.Deferred();

def.done( fun1, fun2, fun3)

$("button").on("click", function() {



©2022 concretepage.com | Privacy Policy | Contact Us