javascript - Paper-Input autofocus amongst 2 competing paper-inputs -


i have 2 paper inputs (one in header) search engine , defaults autofocus header 1 when both have "autofocus" so.

<paper-input id="bodyinput" name="thetext" type="text" class="searchbar" placeholder="enter search term here..." autofocus> </paper-input> 

the header bar hidden on homepage using .hide() in js. way autofocus main search bar (non-header) homepage?

i'm sharing _header partial in rails needs autofocus header in non-homepages.

perhaps there way programmatically remove "autofocus" part in paper-input header on homepage js?

just can bind custom element properties strings, numbers, objects, etc., can booleans.

in scenario, set variable or property of choosing reflect whether or not current page homepage. code responsible setting true or false. then, employ data-binding this:

<paper-input placeholder="input #1" autofocus="[[ishomepage]]"></paper-input> <paper-input placeholder="input #2" autofocus="[[!ishomepage]]"></paper-input>  <script>   ... ishomepage = true/false; ... </script> 

in example, if ishomepage true, first paper-input has auto-focus enabled. if it's false, second.

here's plunker demonstrates 1 (very basic) example of how works: http://plnkr.co/edit/l0z4v6fvbtrdcwbk0b02?p=preview


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -