我的代码无效。我希望使用getElementById
焦点,下一个输入。
<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content" id="ui-id-2" tabindex="0" style="display: none; top: 359px; left: 432.5px; width: 239px;">
<li class="ui-menu-item" id="ui-id-15" onclick="nextinput1()" tabindex="1">t1</li>
<li class="ui-menu-item" id="ui-id-16" onclick="nextinput1()" tabindex="1">t2</li>
</ul>
<script>
function nextinput1(){
document.getElementById("kkInput").focus();
}
</script>
<input id="kkInput" autocapitalize="off" autocorrect="off" class="nextinput" " name="kkin" placeholder="" autocomplete="new-password" onClick="this.setSelectionRange(0, this.value.length)">
答案 0 :(得分:0)
style="display: none;
您需要从父级ul标记中删除此样式。不知道为什么会那样。
答案 1 :(得分:-1)
您忘了关闭该功能,这是正确的代码:
<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content" id="ui-id-2" tabindex="0" style=" top: 359px; left: 432.5px; width: 239px;">
<li class="ui-menu-item" id="ui-id-15" onclick="nextinput1()" tabindex="1">t1</li>
<li class="ui-menu-item" id="ui-id-16" onclick="nextinput1()" tabindex="1">t2</li></ul>
<script type="text/javascript">
function nextinput1(){
document.getElementById("kkInput").focus();
}
</script>
<input id="kkInput" autocapitalize="off" autocorrect="off" class="nextinput" " name="kkin" placeholder="" autocomplete="new-password" onClick="this.setSelectionRange(0, this.value.length)">