How can I recover a Css class that was add via JQuery in my <asp:TextBox> component ?
Example:
ASPX
<asp:TextBox ID='txtTest' runat='server' CssClass='inputText'></asp:TextBox>
JQUERY
$('#txtTest').addClass('testClass');
Page Renderized
<input type='text' ID='txtTest' CssClass='inputText testClass' />
Code Behind
How can I recover the testClass that was add via Jquery in my <asp:TextBox> component ?
I tryied this.txtTest.CssClass but return just inputText class.
You won’t be able to retrieve this because changes to style aren’t even submitted in the request. ASP.NET will reconstruct the object from what “it knows” about it, that is, the original markup in this case.
If you must keep track of this, then you are going to have to add the new class to a hidden element and retrieve it on code-behind:
Then the jQuery part:
And on code behind: