JQuery Textarea

Textarea are used to collect more line of data from users.

Reading the data entered in textarea

Our textarea id=textarea_dtl, here is the code to read the value entered inside a text box.
var str=$('#textarea_dtl').val();
Here we stored the text box data in a variable str.
We can display the data entered by connecting it to a button click function.
HTML part
<textarea rows=2 cols=30 name=textarea_dtl id=textarea_dtl></textarea> <button name=b1 id=b1>Copy</button>   <div id=d1></div> 
$(document).ready(function() {
var str=$('#textarea_dtl').val();

Adding Bootstrap Design

We will add class='form-control' to our textarea.
<textarea class='form-control' rows=2  name=textarea_dtl id=textarea_dtl></textarea>

Setting the value of a textarea

We will use val() to update or add text to our textarea.
<textarea rows=2 cols=30 name=textarea_dtl2 id=textarea_dtl2 class='form-control'></textarea> <button name=b12 id=b12>Show Data</button>

$(document).ready(function() {
$("#textarea_dtl2").val('Default Data to be shown inside textarea');
Your Rating


Post Comment This is for short comments only. Use the forum for more discussions.

Most Popular JQuery Scripts


Two dependant list boxes


Calendar with Date Selection


Data change by Slider


Show & Hide element
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer