javascript - jQuery Class is not adding after division refresh -


i have jquery code when button-refresh clicked, table-data table refreshed. when refreshed, class negative not adding td

below code

$("#button-refresh").click(function(){     $("#table-data").load("index.php #table-data");     $("td[name=td-total").each(function() {       var text = $(this).text();         var num = parsefloat(text);         if (num < 0) {           $(this).addclass("negative");         }     }); }); 

use callback method of .load()

$("#button-refresh").click(function(){   $("#table-data").load("index.php #table-data", function() {     $("td[name=td-total").each(function() {       var text = $(this).text();       var num = parsefloat(text);       if (num < 0) {         $(this).addclass("negative");       }     });   }); }); 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -