Text in <STRONG> Tag turns RED

3 posts, 0 answers
  1. Victor
    Victor avatar
    11 posts
    Member since:
    Oct 2008

    Posted 21 Oct 2008 Link to this post

    Hi, just wanted to mention that RADSpell is pretty sweet. It's flexible enough to work throughout my applications.

    I am using RADspell to sepll check HTML within a DIV tag.
    For some reason when RADSpell encounters a strong tag (e.g. <strong>hello</strong>) it turns the text red and underlines it. I noticed that the same behaviour does not occur on B tags.

    Is there a work around for this issue (other than switching STRONG to B tag)?

    Thank You
  2. George
    Admin
    George avatar
    859 posts

    Posted 23 Oct 2008 Link to this post

    Hi Victor,

    Please use the following approach to change the text's decoration:
    <script type="text/javascript">  
        function OnClientCheckStarted(sender, args)  
        {  
            window.setTimeout(function(){  
                var framedoc = window.frames["RadSpell1dialogOpenerSpellCheckDialog"].document;  
                var textbox = framedoc.getElementById("dialogControl_TextContainer");  
                var elmts = textbox.getElementsByTagName('strong');  
                for(var i =0; i<elmts.length; i++)  
                {  
                    var elemStyle = elmts[i].style;   
                    elemStyle.color = "black" ;  
                    elemStyle.textDecoration = "none";  
                    elemStyle.fontWeight = "normal";  
                }  
            },700);                     
        }  
    </script>  
    <asp:TextBox ID="txt1" runat="server"><strong>Some contnett</strong></asp:TextBox>  
    <telerik:RadSpell OnClientCheckStarted="OnClientCheckStarted" ID="RadSpell1" runat="server" ControlToCheck="txt1" /> 

    I hope this helps.

    Kind regards,
    George
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Victor
    Victor avatar
    11 posts
    Member since:
    Oct 2008

    Posted 23 Oct 2008 Link to this post

    Thanks for the code.
    I found another way of doing it:
    Define a custom text source and replace all <strong> tags with <b> tags.
    Once the spell checker is complete you can convert everything back to <strong> tab.
    I tested this code on FireFox 3 and IE 7.

    this.get_text = function() {  
     return anObject.innerHTML.replace(/<strong/gi,'<b').replace(/<\/strong/gi,'</b');  
    }          
    this.set_text = function(text) {  
        anObject.innerHTML=text.replace(/<b/gi,'<strong').replace(/<\/b/gi,'</strong');  
Back to Top