我需要有关此代码的帮助。单击搜索图标时,如何获取要显示的搜索字段。svg?
<form role="search" method="get" class="search-form" action="<?php echo home_url( \'/\' ); ?>">
<label>
<span class="screen-reader-text"><?php echo _x( \'Search for:\', \'label\' ) ?></span>
<input type="search" class="search-field"
placeholder="<?php echo esc_attr_x( \'Search …\', \'placeholder\' ) ?>"
value="<?php echo get_search_query() ?>" name="s"
title="<?php echo esc_attr_x( \'Search for:\', \'label\' ) ?>" />
</label>
<input type="image" alt="Search" src="<?php bloginfo( \'template_url\' ); ?>/images/search-icon.svg" />
.site-header .search-field {
background-color: transparent;
border: none;
cursor: pointer;
height: 37px;
padding: 0 0 10px 34px;
position: relative;
-webkit-transition: width 400ms ease, background 400ms ease;
transition: width 400ms ease, background 400ms ease;
width: 0;
}
.site-header .search-field:focus {
background-color: #fff;
border: 2px solid #333;
cursor: text;
outline: 0;
width: 230px;
}
.search-form
.search-submit {
display:none;
}
input[type="image"] {
height: 30px;
}