Click here to Skip to main content
15,891,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Select index change event not fire in chrome if using html editor extender
Posted
Updated 22-Jul-14 19:11pm
v2

1 solution

C#
<pre lang="cs">&lt;script&gt;

       $(document).ready(function () {
           if (Sys.Extended &amp;&amp; Sys.Extended.UI &amp;&amp; Sys.Extended.UI.HtmlEditorExtenderBehavior &amp;&amp; Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype &amp;&amp; Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype._editableDiv_submit) {
               Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype._editableDiv_submit = function () {
                   //html encode
                   var char = 3;
                   var sel = null;

                   setTimeout(function () {
                       if (this._editableDiv != null)
                           this._editableDiv.focus();
                   }, 0);
                   if (Sys.Browser.agent != Sys.Browser.Firefox) {
                       if (document.selection) {
                           sel = document.selection.createRange();
                           sel.moveStart('character', char);
                           sel.select();
                       }
                       else {
                           if (this._editableDiv.firstChild != null &amp;&amp; this._editableDiv.firstChild != undefined) {
                               sel = window.getSelection();
                               sel.collapse(this._editableDiv.firstChild, char);
                           }
                       }
                   }

                   //Encode html tags
                   this._textbox._element.value = this._encodeHtml();
               }
           }
       });
   &lt;/script&gt;</pre>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900