reset radio buttons after submit code example
Example 1: what is html injection on a sample form having textbox, radio button, reset button, submit button
<form>
<table>
<tr>
<td>
<label for="uname">Name</label>
</td>
<td>
<input type="text" id="uname" name="username">
</td>
</tr>
<tr>
<td>
<label for="age">Age</label>
</td>
<td>
<input type="text" name="userage" id="age" size="2" maxlength="2">
</td>
</tr>
<tr>
<td>
<label>Gender</label>
</td>
<td>
<label>
<input type="radio" value="f" name="gender"> Female</label>
<label>
<input value="m" type="radio" name="gender"> Male</label>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" value="Submit">
<input type="reset">
</td>
</tr>
</table>
</form>
Example 2: clear the input when change the radio button
$('input[name="am_payment"]').on('click', function() {
if ($(this).val() === '') {
$('#theamount').val('').prop("removed", true).focus();
}
else {
$('#theamount').val('').prop("disabled", false);
}
});