faqts : Computers : Programming : Languages : JavaScript : Forms

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

13 of 66 people (20%) answered Yes
Recently 2 of 10 people (20%) answered Yes

Entry

Line break needs to be inserted into a textfield using Javascript when code is called.How do I that?

Aug 11th, 2006 15:49
David Alden, Kevin Smith,


<html>
<script type="text/javascript" language="javascript">
	function insertLineBreak(){
		document.thisForm.thisTextarea.value = 
document.thisForm.thisTextarea.value+"\n";
	}
</script>
	<form name="thisForm">
		<textarea rows="10" cols="100" 
name="thisTextarea"></textarea>
		<br>
		<input type="button" onclick="insertLineBreak()" 
value="Insert Line Break">
	</form>
</html>