title: CreateTextRange is not working in Chrome
body: <p>In this code, <code>createRange</code> is not working in Chrome. In IE it is working. Please help how to rectify in this. Is there any other property to work like create range. So that it will helpful for my project.</p>
  
  <pre><code>&lt;script language=javascript&gt;
  
      var isSelected;
      function markSelection ( txtObj ) {
        if ( txtObj.createTextRange ) {
          txtObj.caretPos = document.selection.createRange().duplicate();
          isSelected = true;
        }
      }
  
      function insertTag ( txtName, enclose ) {
          if(document.f_activity_email == null) {
              var tag = document.getElementById('EmailTokenID').value;
          }
          else {
              var formC = document.f_activity_email;
              var tag = formC.EmailTokenID.value;
          }
          var closeTag = tag;
          if ( enclose ) {
              var attribSplit = tag.indexOf ( ' ' );
              if ( tag.indexOf ( ' ' ) &gt; -1 )
                closeTag = tag.substring ( 0, attribSplit );
          }
          if ( isSelected ) {
              var txtObj = eval ( "document.forms[0]." + txtName );
                  if (txtObj.createTextRange &amp;&amp; txtObj.caretPos) {
                      var caretPos = txtObj.caretPos;
                      caretPos.text = ( ( enclose ) ? "&lt;"+tag+"&gt;"+caretPos.text+"&lt;/"+closeTag+"&gt;" : tag+caretPos.text );
                      markSelection ( txtObj );
                      if ( txtObj.caretPos.text=='' ) {
                       isSelected=false;
                      txtObj.focus();
                  }
              }
        } else {
          // placeholder for loss of focus handler
        }
      }
  </code></pre>