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!

Recommended Answers

All 2 Replies

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.