my textbox has a class='cssText'
. I want to change this class to 'blck'
at runtime.
How can I access the class attribute of textbox and change its value using jQuery?
Thanks
my textbox has a class='cssText'
. I want to change this class to 'blck'
at runtime.
How can I access the class attribute of textbox and change its value using jQuery?
Thanks
$("input#id").removeClass("cssText").addClass("blck");
or
$("input#id").attr("class", "blck");
You shoudl select the textbox and then set the new class:
$(selector_for_textbox).removeClass('cssText').addClass('blck');
A possible selector for your textbox could ofcourse be the class, or otherwise an id or something:
$('#textbox'). //etc
$('input.cssText:text'). //etc
Edit from comments
You should use:
$('#txt').removeClass('cssText').addClass('blck');