• Resolved Skavenmight

    (@skavenmight)


    First I must say that I’m not good at coding but I did manage to create this searchform.
    I made my own searchbar in searchform.php by tweaking it with CSS. But I noticed that I cannot add any text (Placeholder) inside the.
    Could anyone give me a hand and show me how to add a Placeholder text to my search bar? I have tried it in different ways but it seems more complex then I thought.. Thank you

    This is my code:

    <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
        <div>
    
    <label class="screen-reader-text" for="s">
    </label>
            <input type="text" value="" name="s" id="s" />
            <input type="submit" id="searchsubmit" value="GO" />
        </div>
    </form>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Try:

    <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
        <div>
    <label class="screen-reader-text" for="s">
    </label>
            <input type="text" value="" name="s" id="s"  placeholder="<?php esc_attr_e( 'Search'); ?>" />
            <input type="submit" id="searchsubmit" value="GO" />
        </div>
    </form>
    Thread Starter Skavenmight

    (@skavenmight)

    Perfect!! Exactly what I was looking for. ??
    Thanks a million!

    Glad I could help ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Placeholder in SearchForm’ is closed to new replies.