jquery - event, when (inner) html changes -


i catch event when innerhtml of element changes due "ajaxing".

i mean this:

$('.t_error span').html.change(function(){ ...  }); 

thanks help!

there no way ask - however, instead can use construct:

 $.ajax({    type: "get",    url: yoururl:,    success: function (data) {        ajaxcomplete();    }  }); 

 function ajaxcomplete()  {      ....  } 

edit: if want cleverer, use custom events:

basically define customevent function:

var customevent = function() {   //name of event   this.eventname = arguments[0];   var meventname = this.eventname;    //function call on event fire   var eventaction = null;    //subscribe function event   this.subscribe = function(fn) {     eventaction = fn;   };    //fire event   this.fire = function(sender, eventargs) {     this.eventname = eventname2;     if(eventaction != null) {         eventaction(sender, eventargs);     }     else {         alert('there no function subscribed ' + meventname + ' event!');     }   }; }; 

then need create instance of customevent class somewhere:

 var myevent = new customevent("my event"); 

in page, subscribe it:

 myevent.subscribe(function(sender, eventargs) {     alert(eventargs.message);  }); 

and in ajax call success function, trigger it:

$.ajax({    type: "get",    url: yoururl:,    success: function (data) {        myevent.fire(null, {message: 'you witnessed firing of custom event called ' + this.eventname + '!'});    } }); 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -