• Resolved Kiko Rufa

    (@kiko-rufa)


    Dears,

    I can focus the cursor in the widget form field ‘Email’ with the following:

    jQuery(document).ready(function($) { jQuery(‘.es_required_field:first’).focus(); });

    The basic information is found using Firefox’s element inspector. But, I can’t seem to find how to focus the cursor in the ‘Name’ field, which is what I want to accomplish. The same element inspector returns a blank…

    Any hints are very much appreciated!

    Kiko

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Why don’t you just use the name selector of the input field instead of using a CSS class?

    https://api.jquery.com/attribute-contains-selector/

    jQuery(document).ready(function($) { jQuery(‘input[name='name']’).focus(); });

    • This reply was modified 5 years, 11 months ago by olivermerk.
    • This reply was modified 5 years, 11 months ago by olivermerk.
    Thread Starter Kiko Rufa

    (@kiko-rufa)

    Thank you ‘olivermerk’,
    Tried your suggestion. Makes sense. But… it does not give the expected effect…
    Some more info:
    – using WordPress 5.1.1.
    – using plugin ‘Email Subscribers and Newsletters’ version 4.0.9
    I am putting the code in footer.php of a child theme of Theme Twentysixteen.
    Cheers again,
    Kiko

    Thread Starter Kiko Rufa

    (@kiko-rufa)

    I think I see what probably was the problem. I battled a bit with the various types of quotation marks in olivermerk’s code. Then I tried it without the quotation marks of the name selector field. This did the trick. The successful code therefore is:
    jQuery(document).ready(function($) { jQuery(‘input[name=name]’).focus(); });

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to focus cursor in widget form field ‘Name’?’ is closed to new replies.