Set textbox value by array index and name attribute using jquery
$("[name=imageheight]") return following array of textboxes
I know i can get the value of textbox by its index like
How do i set the value of textbox on index 0. i have tried this but it gives me a error
$('input').eq(0).val("new value")
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" />
$('[name=imageheight]').eq(0).attr('value', '250')
您可以使用
$('[name=imageheight]').eq(0).val(250)
链接地址: http://www.djcxy.com/p/36278.html
上一篇: 动态填充表单中动态创建的元素的下拉列表