发现textarea标签与input标签设置默认值不同,input有value属性,但是textarea没有,所以需要在textarea设置默认值,则可通过以下方法:
1.直接这样:
<textarea>hello!</textarea>
2.或者根据id获取元素,并设置默认值
<textarea id="t1"></textarea>
<script>
document.getElementById("t1").value="hello!"
</script>
但切记,以下的做法是错误的!!!
<textarea id="t1" value="hello!"></textarea>

每天都努力一点
谢谢你看完
网友评论