[英]JavaScript .focus() function not working in a text field
我试图在以下表单字段上使用 .focus() 但没有成功。 该元素所在的div的tabindex
为0。
<input class="form-control ng-pristine ng-valid ng-empty ng-touched" id="accessionNumber" type="text" name="filter.accessionNumber" ng-model="selectFields.accessionNumber" style="">
我正在使用以下内容:
document.getElementsByName("filter.accessionNumber")[0].focus()
我也尝试过使用“accessionNumber”ID 以及 .click .click()
function 而不是.focus()
function 的document.getElementById
,但到目前为止都没有用
谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.