enwise — 2011-11-20T21:36:21-05:00 — #1
What I'm trying to do is display whatever is typed within an input field simultaneously inside of a <p> tag.
If the name Mark is typed into the input field, i would want "Mark" displayed somewhere else on the page inside of a <p> tag and the letters are typed in the input field it displays each etter as its being typed.. is this possible?
kohoutek — 2011-11-20T21:39:51-05:00 — #2
enwise — 2011-11-20T21:47:59-05:00 — #3
just tested it out it seems to be exactly what im looking for thank you!
enwise — 2011-11-20T21:48:33-05:00 — #4
enwise — 2011-11-20T21:52:10-05:00 — #5
why is that inline scripting frowned on?
system — 2011-11-20T21:54:15-05:00 — #6
inline scripting still has its place but it's generally frowned upon nowadays as part of the higher emphasis on keeping content, styling and functionality as separate as possible.
system — 2011-11-20T21:50:04-05:00 — #7
You could put an onkeyup event handler on the <input> which takes the current value of the <nput> and assigns it to the innerHTML property of a <p>.
If you use the now frowned inline scripting, your can do it with a 1 line onkeyup in the <input>. No need for jQuery at all.
enwise — 2011-11-20T21:56:12-05:00 — #8
I'm going to be using the input field for names, for something as simple as that would you say the jquery method or the onkeyup method would be better to use?
system — 2011-11-20T22:05:41-05:00 — #9
Use whichever you are more comfortable with.
But who knows how much extra code jQuery runs in the background to perform the same task. I suspect it'll be a lot more lines of code than 3-4 max it would take without jQuery.