jQuery - dynamically binding a CSS class on an attr? -
jQuery - dynamically binding a CSS class on an attr? -
i have table rows unique, each row has unique id. however, table dynamically generated through ajax.
i have button meant update particular table row bgcolor. since table row may dynamically generated, doesn't seem work.
$("input[name=save]").live("click", function(event){ //rowid comes somewhere in script $.ajax({ type: "post", url: "./library/savestff.php", data: $("form").serialize(), async: false, datatype: "text", success: function(value){ //value homecoming color //change color $(".info_"+rowid).attr('bgcolor', value); } }); });
'live', 'on', 'bind' seems work events only. want apply attr/bgcolor.
using
$(".info_"+rowid).live("attr", $(this).('bgcolor', value));
also seem invalid.
use css()...try this
$(".info_"+rowid).css('background-color', value);
as of jquery 1.7, .live() method deprecated.
use on()
("input[name=save]").on("click", function(event){..
jquery attr
Comments
Post a Comment