Search code examples
javascriptwysiwygjwysiwyg

show blink text cursor on html document


I am writing my own WYSIWYG html editor based on jquery. In order to achieve this goal, I am exploring jWYSIWYG. I've figured out that I need usual html container(e.g div) in order to show formatted text.And I need to bind all events(keydown, mouseclick) for applying changes on this container. There is another problem: How to show blink text cursor. I can't realized how this implemented in jWYSIWYG. There is a simple iframe with html document. How they show blink text cursor???


Solution

  • look at contentEditable property;

    getElementById('YourDiv').contentEditable = true;
    

    http://www.dynamicdrive.com/forums/showthread.php?p=74576#post74576

    There are many similar questions here:

    How to make a div with a blinking cursor and editable text without using <input>?

    https://stackoverflow.com/questions/4799445/create-a-blinking-cursor