2

I'm not able to enter text in input in firefox. Same code is working fine with chrome. I'm not facing any css issues. I'm not using jquery.

below is my html code

<div class="todo_content" style="width:66%">
  <input class="todo_add_input" autofocus="autofocus"
         placeholder="Please Add Task"  
         ng-model="addtask.activity_title" id="task-title">
</div>

when rendered it is producing below html code.

<div class="todo_content" style="width:66%">
  <input class="todo_add_input ng-pristine ng-valid ng-empty ng-touched" 
         autofocus="autofocus" placeholder="Please Add Task"
         ng-model="addtask.activity_title" id="task-title"
         aria-invalid="false" style="">
</div>

Why, same code is not working in firefox?

sachin makwana
  • 103
  • 1
  • 1
  • 12
  • Possible duplicate of [Autofocus doesn't work on Firefox and doesn't work when coming from another page](https://stackoverflow.com/questions/26364577/autofocus-doesnt-work-on-firefox-and-doesnt-work-when-coming-from-another-page) – Ramesh Rajendran Apr 16 '18 at 06:56
  • Also check this as well : https://webmasters.stackexchange.com/questions/15020/why-doesnt-autofocus-autofocus-work-in-mozilla-firefox – Ramesh Rajendran Apr 16 '18 at 06:58
  • @RameshRajendran : for the first link which you provided is based on jquery. I've asked for angularjs. I've search through many questions but didn't fine proper solution. for the second link, My firefox version is up to date still I'm facing this issue. – sachin makwana Apr 16 '18 at 07:06
  • @georgeawg: i'm not facing any css issue. all the css are applied correctly, except I'm not able to enter text in textbox!! – sachin makwana Apr 16 '18 at 07:10
  • **Divide and conquer.** Remove attributes one at a time until the problem disappears – then add the last part back. This will let us know which attribute is causing the problem. – georgeawg Apr 16 '18 at 13:43

1 Answers1

0

try this

Use Directive

 app.directive('autoFocus', function($timeout) {
        return {
            restrict: 'AC',
            link: function(_scope, _element) {           
                    _element[0].focus();
            }
        };
    });

    <input name="theInput" auto-focus>

More details : How to set focus on input field?

Ramesh Rajendran
  • 37,412
  • 45
  • 153
  • 234
  • tried your solution, I removed html5's autofocus attribute and added this directive to my app. for chrome this worked but for firefox it didn't!!! – sachin makwana Apr 16 '18 at 07:16