How to get text area output in JavaScript

Hey Folks,
I am here with another tutorial of JavaScript. In this tutorial, we will learn how to get text area output in JavaScript. This feature of JavaScript we mostly use in billing websites. Because the information we enter is displayed at checkout.

We use onClick() function to give output at click of a button. So let’s start our tutorial on how to get text area output. Let’s divide our code into two parts.

Code to get output in Text Area

We set our form name as frm so it would be easier for us. We create a function named find(). And also we make if and else condition for the to radio buttons. As we have to keep a track which radio button is clicked. But we don’t do the same with check boxes. As one or more check boxes can be selected.

And also all check boxes have a different name. We store value of all text in different variables. And at last we sum up all the variables and assign it to text box named t3.

<!DOCTYPE html>
function find()
var a,b,c,d
c=" "
d=" "
else if(document.frm.r[1].checked)
d="cricket" +d
d="football" +d
document.frm.t3.value=a + " " + b + " " + c + " " + d
<form name="frm">
<input type="text" name="t1">
<input type="password" name="t2">
<input type="radio" name="r">
<input type="radio" name="r">
<input type="checkbox" name="c1">
<input type="checkbox" name="c2">
<textarea rows="6" cols="14" name="t3">
<br><input type="button" value="click" onClick="find()">


In form tag we create name of type text and password of type password. But we keep names of all these text boxes different in order to use them in script tag.

I hope you understood the code. Feel free to ask your doubts in comment below.

You must also read,

Leave a Reply

Your email address will not be published. Required fields are marked *