Relatively new to this; I have an asp.net page that I want to remove CSS class formatting for a specific control. (An asp:textbox and ajax:HtmlEditorExtender)
The page that contains the control uses a Master page where the CSS stylesheet is referenced.. I want to remove everything attached to <blockquote> and <p>.. I suspect I am making some sort of newbie mistake.
Put the jquery reference line in it's own script block, and then the other code in another script block and do it in document ready. So something like:
Frustrating.. There has to be some small detail I must be missing.
The value of CssClass property of the textbox, during events Page_Load, txtComments_PreRender and txtComments_Init, is always empty..("")
2:17:2012: Should I post this in the ajax section? If I comment out the css the control works as expected, yet I cant remove the style from the control via the previously recommended methods.
StevenSchult...
Member
19 Points
7 Posts
Cant get <elm>.removeClass() to work correctly.
Feb 15, 2012 11:47 AM|LINK
Relatively new to this; I have an asp.net page that I want to remove CSS class formatting for a specific control. (An asp:textbox and ajax:HtmlEditorExtender)
The page that contains the control uses a Master page where the CSS stylesheet is referenced.. I want to remove everything attached to <blockquote> and <p>.. I suspect I am making some sort of newbie mistake.
Thanks in advance.
Here is the code Ive tried.
<script src="Scripts/jquery-1.7.1.min.js" type="text/javascript"> $('blockquote').removeClass(); $('blockquote:before').removeClass(); $('blockquote:after').removeClass(); $('blockquote:hover').removeClass(); $('p').removeClass(); </script>solideagle
Member
163 Points
124 Posts
Re: Cant get <elm>.removeClass() to work correctly.
Feb 15, 2012 11:52 AM|LINK
try examples given on this page?
http://api.jquery.com/removeClass/
If you know the class name you can specify the class name in removeclass([Class Name]).
try wrapping your code in
$(document).ready(function () { //your code $(p).each(function(){ $(this).removeAttr("class"); //or $(this).removeclass("className"); }) });MetalAsp.Net
All-Star
112168 Points
18255 Posts
Moderator
Re: Cant get <elm>.removeClass() to work correctly.
Feb 15, 2012 11:53 AM|LINK
Put the jquery reference line in it's own script block, and then the other code in another script block and do it in document ready. So something like:
<script src="Scripts/jquery-1.7.1.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $('blockquote').removeClass(); $('blockquote:before').removeClass(); $('blockquote:after').removeClass(); $('blockquote:hover').removeClass(); $('p').removeClass(); </script>StevenSchult...
Member
19 Points
7 Posts
Re: Cant get <elm>.removeClass() to work correctly.
Feb 15, 2012 07:11 PM|LINK
Ive tried both examples, neither are working for me.
<script src="Scripts/jquery-1.7.1.min.js" type="text/javascript" /> <script type="text/javascript"> $(document).ready(function () { $('blockquote').removeclass(); $('blockquote:before').removeclass(); $('blockquote:after').removeclass(); $('blockquote:hover').removeclass(); $('p').removeclass(); } }); </script>$(document).ready(function () {$('blockquote').removeClass();$('blockquote:before').removeClass();$('blockquote:after').removeClass();$('blockquote:hover').removeClass();$(p).each(function () {$(this).removeAttr("class");MetalAsp.Net
All-Star
112168 Points
18255 Posts
Moderator
Re: Cant get <elm>.removeClass() to work correctly.
Feb 15, 2012 07:18 PM|LINK
StevenSchult...
Member
19 Points
7 Posts
Re: Cant get <elm>.removeClass() to work correctly.
Feb 16, 2012 10:17 AM|LINK
Changed but made no difference.
Frustrating.. There has to be some small detail I must be missing.
The value of CssClass property of the textbox, during events Page_Load, txtComments_PreRender and txtComments_Init, is always empty..("")
2:17:2012: Should I post this in the ajax section? If I comment out the css the control works as expected, yet I cant remove the style from the control via the previously recommended methods.
2:20:2012: Well, thanks for trying.