Paste html in place of selected text

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wwecricket
    New Member
    • Jul 2007
    • 1

    Paste html in place of selected text

    hi,
    i want to insert span tag in place of selected text

    i m doing this ....
    document.execCo mmand('copy',fa lse);
    selectedText = window.clipboar dData.getData(" Text");
    window.clipboar dData.setData(" Text","<span>"+ selectedText+"</span>");

    but it is inserting it as text rather then html ... wat shud i do ?
  • ashsa
    New Member
    • Feb 2007
    • 45

    #2
    Originally posted by wwecricket
    hi,
    i want to insert span tag in place of selected text

    i m doing this ....
    document.execCo mmand('copy',fa lse);
    selectedText = window.clipboar dData.getData(" Text");
    window.clipboar dData.setData(" Text","<span>"+ selectedText+"</span>");

    but it is inserting it as text rather then html ... wat shud i do ?
    could you be a bit clear?? where do you wanna insert the span tag ?

    Comment

    • kovik
      Recognized Expert Top Contributor
      • Jun 2007
      • 1044

      #3
      Originally posted by wwecricket
      hi,
      i want to insert span tag in place of selected text

      i m doing this ....
      document.execCo mmand('copy',fa lse);
      selectedText = window.clipboar dData.getData(" Text");
      window.clipboar dData.setData(" Text","<span>"+ selectedText+"</span>");

      but it is inserting it as text rather then html ... wat shud i do ?
      Inserting as text where? In a textarea? You cannot put HTML into an input or textarea.

      Comment

      • shweta123
        Recognized Expert Contributor
        • Nov 2006
        • 692

        #4
        Hi,

        Can you please refer this Link

        Comment

        Working...