JQuery.live () and the finished document

I am trying to set the CSS style with .live (). CSS function:

$(".data tr:odd").addClass("evenrows"); 

Is there a way for this to happen automatically when preparing a document, but still for future elements? I have an ajax event on a page that reorders a table. I need these newly created lines to apply their .addClass.

Thanks in advance.

+5
source share
3 answers

you can use the livequery plugin . It binds to DOM mutation events to track changes in the DOM, and re binds and re executes the code attached to them, for example:

$(".data tr:odd").livequery(function(){
   $(this).addClass("evenrows");
});
+5
source

JavaScript ajax, . , , , .

:

GlobalObject.AjaxFunction(sUrl, SData, fnOnSuccess, fnOnError, oExtension)
{
   //Set up Ajax process

   // check type of extension as a function
   if (typeof oExtension === 'function')
   {
      oExtension();
   }
}

ajax.

, , , !

0

All Articles