关注显示的标签不起作用,我的js
$(document).ready(function(){
$(":input:visible").each(function () {
$(this).focus();
});
});
HTML
<div class="tab-content">
<div class="active" id="note-tab" ng-show="currentTab==1">
<form ng-submit="postStatus()">
<input placeholder="Your private notepad here.." class="status-input" type="text"
ng-model="newItem" autofocus>
</form>
</div>
<div class="" id="quotes-tab" ng-show="currentTab==2">
<form ng-submit="postStatus()">
<input placeholder="Inspiring thoughts on your mind.." class="status-input" type="text"
ng-model="newItem" autofocus>
</form>
</div>
<div class="" id="project-tab" ng-show="currentTab==3">
<form ng-submit="postStatus()">
<input placeholder="Milestones you've accomplished.." class="status-input" type="text" ng-model="newItem" autofocus>
</form>
</div>
<div class="" id="skill-tab" ng-show="currentTab==4">
<form ng-submit="postStatus()">
<input placeholder="Skills that you've learned.." class="status-input" type="text"
ng-model="newItem" autofocus>
</form>
</div>
</div>
起初我认为我的搜索栏引起了问题,所以我对它进行了评论,但它并没有解决我的问题。
答案 0 :(得分:1)
你无法集中所有输入,你可以做其中一个
$("input:visible:first").focus();
答案 1 :(得分:0)
试试这个:
$(document).ready(function() {
$("input:text").each(function () {
$(this).focus();
});
});
答案 2 :(得分:0)
试试这个
$(document).ready(function(){
$("input:visible").focus();
});