duangangmo0583
duangangmo0583
2017-01-23 20:23

从搜索栏html替换水印文本

已采纳

I would like to change watermark text and pup-up text on my search bar.

Search box looks like on image bellow - I would like to change "Search ..." and "Search for:" texts:

Search bar

Search box code from searchform.php :

 <div class="search-wrapper">

<form role="search" method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">

    <label>

        <span class="screen-reader-text"><?php echo _x( 'Search for:', 'label', 'Tesseract' ) ?></span>             

        <input type="search" class="search-field placeholdit" value="<?php echo get_search_query() ?>" name="s" title="<?php echo esc_attr_x( 'Search for:', 'label', 'Tesseract' ) ?>" />

    </label>

    <input type="submit" class="search-submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'Tesseract' ) ?>" />

</form>

I find out that replacing "Search for:" changes the pop-up text but how to change watermark text?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • doubushi0031 doubushi0031 4年前

    You could try add placeholder="New text" to input type="search" element.

    Additionally you could lookup whether you have some additional javascript that reacts with the element or its class (e.g. with class placeholdit).

    点赞 评论 复制链接分享
  • duanfengtuo6012 duanfengtuo6012 4年前

    Replace value="<?php echo get_search_query() ?>" with what you want.

    You mean by "watermark" you mean the Search ... text?

    点赞 评论 复制链接分享

相关推荐