Reputation: 201
focus on tab shown doesn't work this way, my 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>
At first at I thought my seach bar caused the problem, so I commented it out, but it doens't solve my problem.
Upvotes: 0
Views: 78
Reputation: 959
try this
$(document).ready(function(){
$("input:visible").focus();
});
Upvotes: 0
Reputation: 15393
Try this:
$(document).ready(function() {
$("input:text").each(function () {
$(this).focus();
});
});
Upvotes: 0
Reputation: 7954
you cannot focus all your inputs,you can do one of them
$("input:visible:first").focus();
Upvotes: 1