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?
- Failed to load resource: the server responded with a status of 404 (Not Found)
- 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?
- 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]
- Is there a color code for transparent in HTML?
- Change Background color (css property) using Jquery
- “Stray start tag footer” in html validator?
- How to change css property using javascript
- Use images like checkboxes
- JavaScript Loading Screen while page loads
- Completely disable scrolling of webpage
- HTML Width Percentage
- Text-decoration: none not working
- Why are my CSS3 media queries not working on mobile devices?
- How to completely remove borders from HTML table
- 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?
- How to center HTML5 Videos?
- How to center HTML5 Videos?
- HTML span align center not working?
- Set bootstrap modal body height by percentage
- Display Images Inline via CSS
- Text wrapping around a div
- Why CSS3 Animation is not working?
- Change an image with onclick()
- JavaScript – Count Number of Visitor for Website
- Using margin / padding to space span tag from the rest of the p tag
- 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)?
- How to make canvas responsive
- How to set “style=display:none;” using jQuery’s attr method?
- Local wordpress install only shows home page, all other pages Not Found
- WordPress Bootstrap Handburger Menu Wont Open
- Could the WP script/style loader be used to concatenate and gzip scripts and styles in the front-end?
- How to combine multiple CSS files and concatenate JavaScripts if WordPress recommends enqueuing them?
- raw code vs wordpress
- Can “ and “ tags be used in the HTML editor?
- Adding HTML to the Header, Screws up in IE7
- Does costum code in the root folder get lost when wordpress is updated?
- Changing CSS FilePath for All Pages
- CSS Minification
- Why is this jquery / java script code not working in mobile / in devices?
- Seperate functions.php for part of site
- Google yolo one tab signup plugin avilable in wordpress? [closed]
- Disable File Editing function
- Some Text of website page on Iphone Safari become invisible
- Get post format and use it as a CSS class in different spans
- HTML email sent with wp_mail shows plain text
- Conditionally enqueue a stylesheet based off of a javascript click event
- Simple way to add custom class and ids to individual Gutenberg blocks
- Custom CSS is not working?
- Link to page with posts of specific type
- how to stop the shaking effect on my homepage [closed]
- How to add class to an html output element in tinyMCE paragraph drop down menu
- WordPress is not displaying CSS file
- Change class names dynamically added to html elements by wordpress
- How would I create the same popup in css and javascript as the one in contact button on the site https://www.sublimotionibiza.com/es/main.html [closed]
- Combine CSS Files without plugin
- WordPress Rest Api access the header and extract stylesheets URL
- Add other class content with reference class value
- WordPress footer always at the bottom of the screen-page
- How to make jquery slider to start afresh [closed]
- WordPress Slider is not working
- How to properly hide the div of an inline collapsible button?
- HTML not resizing
- jQuery for Fade Preload Causes My Site Favicon to Disappear from Tab of Browser
- Web Developer Console: “Slow network is detected.” with fonts
- current menu item hover not working?
- Target a specific container to style on WordPress storefront theme
- issues with a slider – investigations with firebug
- Css style removed but still showing via CDN even after clearing browser cache and purging all caches for site
- The placeholder text doesnt disappear
- WP theme update causes child theme CSS problems
- How to remove audio player styles added by mediaelement.js JavaScript?
- Element works, but not on wordpress site [duplicate]
- Add woocommerce plugin in own theme
- Hiding fields a form in via CSS [closed]
- How do I add JS and CSS to WP (Flatsome)
- WordPress site suddenly not showing some DOM elements but mobile is fine
- Editing size of h3 tag in wordpress on a one-off basis
- IOS Ventura Safari 16.3 position fixed elements goes above scroll bar
- Elementor Contact Form Submit button has empty class