0

I want to have a bullet precede any text typed. When an [Enter] key is pressed, a new line starts with a bullet preceding whatever new text is typed. I've seen this done at fargo.io and workflowy.com and need to know how they do it!

3
Contributors
2
Replies
13
Views
4 Years
Discussion Span
Last Post by iamthwee
0

you need to attached a handler to the window object and get the event's keyCode. If they keyCode is equal to the enter value (42 or something? I don't know off hand), then you create a new "listener" row.

Since the window is listening, you can figure out the keyCode and convert it back to a value/letter and append it to the innerHTML of the currently selected element.

If you are asking for someone to do this for you, Im certain most if not all here would encourage you to try first, and we can help from there.

If you intend on taking up this task, google "keyCode" and you will find that for cross browser use you will also need charCode, or with the latest broken version of key tracking, which. If I recall, you will also want to listen to the keypress event, not the keydown or keyup... or maybe it's keyUp... it's been a while since I have had to do anything with keypress listening.

This site will also be helpful http://www.w3.org/2002/09/tests/keys.html

The code in there will also be useful (if you view the source), and see what they did to disassemble their method.

Good luck!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.