Notice: The devs are no longer actively involved in the forum, so any bug reports regarding the Stylish extension or this website should be sent to them directly at contact@userstyles.org.
Changing your Avatar.
The only way to currently change a forum avatar is through Gravatar.com. The email address used for your Userstyles.org account must be one of the email addresses that is registered to your Gravatar account.

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.