This question is more suited to being asked on Stack Overflow as it is not a WordPress specific question, but here’s a solution for you anyway:
This makes no assumptions about the code controlling the existing functionality on the site, so there might be other ways that are more practical to hook into this process but for now here is an event listening that listens for a click on the “search button”, then after waiting 200 miliseconds, the callback function provided to setTimeout will focus the cursor onto the input field that is shown when the search container overlays the full-screen.
!(function($){
$(function(){
$('.search-button').on('click', function(event) {
setTimeout( function() {
$('.search-form-input').focus();
}, 200)
});
});
})(jQuery);
Related Posts:
- Write text below a specific part of a sentence
- How to insert html/css/javascript code to wordpress plugin
- How to integrate my HTML and javascript into my child theme
- How to create fa-bars animated menu
- Cannot set property ‘className’ of null at setThemeFromCookie
- How to Add a Read-only Textbox With Text in it That Has a Button to Copy it?
- prevent HTML output if custom field is empty [closed]
- Hide Tab Titles from Tabs Block
- Unable to use Datepicker in a table when inserting a row
- How would I add this code to a single WordPress page?
- Trouble with adding preloader to my home page index.html and index.js
- Import HTML code that loads css and javascript into specific page
- Interactive maps in wordpress
- Can I upload my HTML/CSS/Javascript game onto a WordPress page?
- CSS Background Opacity [duplicate]
- How to align a to the middle (horizontally/width) of the page [duplicate]
- Is there a color code for transparent in HTML?
- How can I scroll to an element using jQuery?
- Remove CSS class from element with JavaScript (no jQuery) [duplicate]
- Set cookie and get cookie with JavaScript
- What is the meaning of == $0 that is shown in inspect element of google chrome for the selected element [duplicate]
- Change Background color (css property) using Jquery
- “Stray start tag footer” in html validator?
- How to change css property using javascript
- JavaScript Loading Screen while page loads
- Completely disable scrolling of webpage
- HTML Width Percentage
- right align an image using CSS HTML
- Why are my CSS3 media queries not working on mobile devices?
- How to completely remove borders from HTML table
- Why “Inline-block” doesn’t work properly in this CSS?
- Why is the jquery script not working?
- How to fix a footer overlapping content?
- How to word wrap text in HTML?
- What’s the HTML to have a horizontal space between two objects?
- HTML/CSS float: left; is not working properly
- Textarea Auto height
- How to get current screen width in CSS?
- margin-right is not working with my HTML. How can I center my content?
- how to center an inline div using css?
- HTML span align center not working?
- How to place Text and an Image next to each other in HTML?
- Set bootstrap modal body height by percentage
- Failed to decode downloaded font
- Center HTML Input Text Field Placeholder
- how to display a div triggered by onclick event
- creating a chevron in CSS
- Text wrapping around a div
- jQuery scrollTop() method not working
- JavaScript – Count Number of Visitor for Website
- How to create a hidden
in JavaScript?
- How to expand textarea width to 100% of parent (or how to expand any HTML element to 100% of parent width)?
- Cannot read property ‘style’ of undefined — Uncaught Type Error
- How to make HTML element resizable using pure Javascript?
- How to set “style=display:none;” using jQuery’s attr method?
- WordPress Bootstrap Handburger Menu Wont Open
- How to solve ‘Eliminate render-blocking JavaScript and CSS in above-the-fold’ content for multiple files?
- Collapsible button inside a ul list does work in jsfiddle but not in WP
- Handling URLs in WordPress application
- Can “ and “ tags be used in the HTML editor?
- JavaScript added as link/stylesheet
- Adding HTML to the Header, Screws up in IE7
- What makes WP so SEO friendly?
- Implementing a simple slider in code?
- CSS – Initial HTML Margin Issue On WordPress Site
- Add Codepen animation as Preloader to WordPress
- Adding a Calculator to a WordPress Page
- HTML email sent with wp_mail shows plain text
- custom header navigation has odd spacing [closed]
- ACF Pro with SlickJS [closed]
- Link to page with posts of specific type
- Show/Hide Div for Login Mask
- How to avoid repeating similar properties for all tds of a table in a wordpress post
- WordPress Rest Api access the header and extract stylesheets URL
- Invert porfolio item order
- How to make a function to play only on the home page?
- Where to add this code for a Modal box to work? [closed]
- Overriding inline !important CSS with Javscript code snippet with media query
- Getting and setting CSS variables with JQuery in WordPress backend fails
- Getting click on item to open closest relevant element (popup) with jQuery
- how to modify html on homepage (no home-page.php in my theme)
- Hide CSS class only in single post pages
- current menu item hover not working?
- Content going full width even though container is not
- Page flickers when new html5 video loads
- Target a specific container to style on WordPress storefront theme
- Css style removed but still showing via CDN even after clearing browser cache and purging all caches for site
- My contact form is not being responsive
- I cannot make this position properly in WordPress [closed]
- Pages in another language
- Possible jquery / library conflict in plugin usage
- Add HTML input tag to to site navigation
- Outputting the blogposts or the_content()
- What can cause JavaScript and CSS files to be minified?
- I need css code to divide my webpage sections into two columns
- How to add input search field with roudned corners?
- How do I add JS and CSS to WP (Flatsome)
- “Plate” theme broken after update
- My backround image in css is not showing
- Why does the “visual editor” add useless html-comments and how can I get rid of them?