Support » Theme: Donovan » Search field does not show alert if empty

  • Resolved steve92


    I noticed that if the search field and the submit button are clicked, the code continues the instruction.
    Instead, it should block the sending and show the alert, see attachment.


Viewing 1 replies (of 1 total)
  • Thread Starter steve92


    It was enough to add “required”


    <form role="search" method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
        <span class="screen-reader-text"><?php echo esc_html_x( 'Search for:', 'label', 'donovan' ); ?></span>
        <input type="search" class="search-field"
        placeholder="<?php echo esc_attr_x( 'Search &hellip;', 'placeholder', 'donovan' ); ?>"
        value="<?php echo get_search_query(); ?>" name="s" required
        title="<?php echo esc_attr_x( 'Search for:', 'label', 'donovan' ); ?>" />
       <button type="submit" class="search-submit">
       <?php echo donovan_get_svg( 'search' ); ?>
       <span class="screen-reader-text"><?php echo esc_html_x( 'Search', 'submit button', 'donovan' ); ?></span>
    • This reply was modified 4 months, 2 weeks ago by steve92.
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.