how to increase rows of a textarea

G

garima puri

hi,
iwant to add dynamically some rows in same textarea when a button of
addRows is clicked.
like,if i have 2 rows in a textarea then after clicking a button the
rows must be increased to 4.
help me soon.
thanks
 
P

Peroli

Hi garima,
garima said:
hi,
iwant to add dynamically some rows in same textarea when a button of
addRows is clicked.
like,if i have 2 rows in a textarea then after clicking a button the
rows must be increased to 4.
help me soon.
thanks

Here is how i do it.

<html>
<body>
<textarea id="txtarea" cols="30" rows="5"></textarea>
<input type="button" value="Increment Rows" onClick="moreRows()">
<script language="javascript" type="text/javascript">
function moreRows() {
document.getElementById('txtarea').rows += 2;
}
</script>
<body>
</html>

-- Peroli Sivaprakasam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top