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

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -