Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Input And Textarea Preview

DZone's Guide to

Input And Textarea Preview

·
Free Resource
Preview what you type in an input or a textarea out of them (in a html tag, like a p, hx...)

Seen here: http://amuchamu.bitacoras.com/archivos/2005/02/17/previsualizacion_de_comentarios (spanish explain).

javascript code:


function preview(id1, id2){
	  		var NewText = document.getElementById(id1).value;
	  		splitText = NewText.split(/\n/).join("
"); var DivElement = document.getElementById(id2); DivElement.innerHTML = splitText; }
html code:

Preview

Name:
Phone:
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}