Js USES a loop to clear the value of the input tag in a div
- 2020-03-30 04:02:59
- OfStack
HTML page
<div class="col-xs-9" id="search_songs_a">
<table>
<tbody>
<tr>
<th> Piano music </th>
<td><input type="text" name="info[gqq_name]" id="gqq_name" style="width:200px;"/></td>
<th style="padding-left:10px;"> Player: </th>
<td><input type="text" name="info[gqq_player]" id="gqq_player" style="width:200px;"/></td>
</tr>
</tbody>
</table>
lt;/div>
<div class="col-xs-9" id="search_songs_b">
<table>
<tbody>
<tr>
<th> Belong to Sex: </th>
<td>
<span><input type="radio" name="info[gqq_shuxing]" value=" There is no limit " checked="checked"/><label> There is no limit </label></span>
<span><input type="radio" name="info[gqq_shuxing]" value=" Popular piano music "/><label> Popular piano music </label></span>
<span><input type="radio" name="info[gqq_shuxing]" value=" Classical piano music "/><label> Classical piano music </label></span>
<span><input type="radio" name="info[gqq_shuxing]" value=" Jazz piano "/><label> Jazz piano </label></span>
<span><input type="radio" name="info[gqq_shuxing]" value=" Piano etude "/><label> Piano etude </label></span>
</td>
</tr>
</tbody>
</table>
lt;/div>
Js page
//Clear the search criteria for piano music
function clearsongs()
{
$("#search_songs_a :input").each(function () {
$(this).val("");
});
$("input[name='info[gqq_shuxing]'][value=' There is no limit ']").attr("checked",true);
}