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
Post a Comment