1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > js实现 input 框的动态赋值

js实现 input 框的动态赋值

时间:2019-04-29 12:09:31

相关推荐

js实现 input 框的动态赋值

转载地址

/wilson_m/article/details/79510017

<input id="name1" name="teacherName" type="text" />

通过以下js代码可以实现对input文本框进行赋值,以下方法分别针对不同的情况,但是前两种是通用的。

$('#name1').val('值');document.getElementById('name1').value='值';document.getElementById('name1').html('值');document.getElementById('name1').attr('值');document.getElementById('name1').innerText = '值';

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。