javascript - autofocus attribute not working in Firefox on display state change -


i'm trying add auto focus form. have working in chrome cannot working in firefox below code. think reason potentially needs autofocus rather autofocus="autofocus". correct in assuming this? if there way can add it? i'm using framework called silverstripe , don't have direct access editing input field it's done dynamically need via javascript likely.

<input type="text" name="search" class="form-control search-form" id="templatesearchform_searchform_search" placeholder="search..." autofocus="autofocus"> 

note hiding input box , displaying on click of icon adding class:

jquery('.search').click(function () {     if(jquery('.search-btn').hasclass('fa-search')){         jquery('.search-open').fadein(500);     } else {         jquery('.search-open').fadeout(500);     } }); 

i couldn't find in html specification validate autofocus behavior exhibited chrome. here's excerpt spec on behavior.

from 4.10.19.7 autofocusing form control: autofocus attribute:

when element autofocus attribute specified inserted document, user agents should run following steps:

[...]

note: handles automatic focusing during document load.

it doesn't mention applying behavior when display state changes (as chrome apparently doing), when element first inserted dom. appears a bug in chrome firefox following html spec.

instead of using autofocus attribute, have trigger focus through javascript.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -