append - jQuery add text from a <textarea> to <tr> -
i've checked similar threads, either unclear or advanced i'm still couple of days learning jquery.
i have text area:
<textarea class='text' rows='10' cols='25'></textarea>
and want after user has entered text press add text
button
<button type='button' class='addtext'>add text</button>
and so, text they've entered show in table <tr></tr>
.
i googled can jquery append function, didn't solution problem.
so, there way this?
$('.addtext').click(function(){ $('.smth').append( text in textarea tr ); });
p.s. .smth row class = <tr class='smth'></tr>
in order textarea
's value, use $("#idoftextarea").val()
, e.g.
var text = $("#idoftextarea"); // run dom lookups once if possible var row = $('.smth'); // , store results in variables row.append("<td>"+text.val()+"</td>") // add <td> <tr>, text
Comments
Post a Comment