0

送信後にテキスト フィールドをクリアしたい。私を助けてください :(

<form name ="client" id="client" method="POST" action="index.php"   >
    <input type="hidden" name="id" id="id" >

        <label>name</label>
        <input type="text" name="nombre" id="nombre" value=""> <br />

        <label>surname</label>
        <input type="text" name="apellido" id="apellido"> <br />

        <label>age</label>
        <input type="text" name="fecha" id="fecha" > <br />

        <label>sex</label>
        <select name="peso" id="peso" > <br />
        <option>male</option>
        <option>female</option>
        </select>  <br />


        <input id="submit" type="submit" name="submit" value ="submit"/>

</form>
4

3 に答える 3

0

これにより、送信後にフォーム(またはその他)がリセットされ、他のタイプのhtml入力も含まれます。

お役に立てれば。

// 利用方法

ResetFormControlValues('your form id')


function ResetFormControlValues(parent) {

    $(':input', '#' + parent)
    .val('')
    .removeAttr('checked')
    .removeAttr('selected');
    $('input:radio', '#' + parent).removeAttr('checked');


}
于 2013-10-30T21:42:01.477 に答える