Does anyone know how to escape the square bracket character when setting a class name with jQuery?
Try the following:
$(\'#txtFirstname\').addClass(\
Escape with TWO (2) backslashes.
http://learn.jquery.com/using-jquery-core/faq/how-do-i-select-an-element-by-an-id-that-has-characters-used-in-css-notation/