html中给textarea赋值比较常见的方式:1.html中直接书写;2.通过JS动态修改;
第一种:JQuery给textarea取值和赋值:
1、取值
var qrcodefortemcontent=$("#qrcodefortemcontent").val()。
2、赋值
$("#qrcodefortemcontent").val(“123”);。
第二种:JQuery给label的取值和赋值
1、取值
next_openid=$("#next_openid2").text()。
2、赋值
$("#hasnext2").text('YES')。
第三种:JQuery给input的取值和赋值
1、取值
qrcodeforeverflag=$("#qrcodeforeverflag").val()。
2、赋值
$("#qrcodeforeverflag").val(“123”)。
注意:
在HTML中给textArea赋值
<xmp><textarea>初始值</textarea></xmp>
而不可以用<xmp><textarea
value="初始值"></textarea></xmp>
定义和用法<textarea> 标签定义多行的文本输入控件。 文本区中可容纳无限数量的文本,其中的文本的默认字体是等宽字体(通常是 Courier)。 可以通过 cols 和 rows 属性来规定 textarea 的尺寸,不过更好的办法是使用 CSS 的 height 和 width 属性。