I have created this "shell" in jquery:
Code: link text
Demo: link text
I need that every 100 chars, the prompt go in a new line below. How can I do this ?
Programaticaly, by concatenating <br />
is the only way I can think of.
word-wrap: break-word;
Combined with a width should give you an approximation, but it won't be perfect.
At a high level, you're generating html from JavaScript, so any html which would work standalone will work when generated from JavaScript too. Some possibilities, with varying flexibility:
Pre-formatted text, insert newline "\n"
characters:
<pre>
line one
line two
</pre>
Inserting break tags:
line one<br />
line two<br />
Or my favourite, use paragraph tags:
<p>line one</p>
<p>line two</p>
I like this because you can refer to each line in code as a single DOM element. Set this css to keep the lines side-by-side:
div.code-listing p { margin: 0; padding: 0; }