Set focus to text field (Youtube)

edited July 2018 in Style Development Firefox
Hi.
I already asked the same here and got a solution response from member Anagrammar.
I was trying to set focus to a text field at FacebookDownload page.
Solution was to use Greasemonkey and user script like this:
document.querySelector('.form-control[name="URLz"]').focus();

Now, I'm trying to do the same at Youtube page.
I tried to put
document.querySelector('.form-control[name="search"]').focus();
and
document.querySelector('.form-control[id="search"]').focus();
but none worked.

Any ideas?

Comments

  • This can't be done with CSS, so probably the forums at GreasyFork or OpenUserJS would be a better place to hash it out.

    * https://greasyfork.org/en/forum/
    * https://openuserjs.org/forum

    Or maybe someone here can figure out how the YouTube box works in the Polymer design...
  • There is no .form-control so it won't work. Two ways to do it, that I can think of:

    • Will affect any input element that has #search id.
      document.querySelector('input#search').focus();

    • Should affect only the search element on the navbar.
      document.querySelector('input#search.ytd-searchbox').focus();

Sign In or Register to comment.