4

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???

takayoshi
  • 2,789
  • 5
  • 36
  • 56
  • 2
    Set [contentEditable](http://msdn.microsoft.com/en-us/library/ms537837%28v=vs.85%29.aspx) to true for the div. That's the core essence of what makes the fancy wysiwyg editors work. – Marc B Jul 28 '11 at 16:13
  • 2
    I hope you know what you are getting into with this - `contentEditable` probably has an incredibly complicated set of quirks that need to be worked around. The editor I have written has over 3000 lines of code, and most of that is correcting browser quirks. It doesn't even have list or table support. – Nico Burns Jul 29 '11 at 13:59
  • @takayoshi: Why did you delete [this question](http://stackoverflow.com/questions/6905379/wpf-datagrid-return-key-problem) after I solved your issue? – Jalal Said Aug 01 '11 at 23:11

1 Answers1

3

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

Community
  • 1
  • 1
Satish
  • 6,457
  • 8
  • 43
  • 63