| 両方とも前のリビジョン前のリビジョン | |
| study:javascript:jquery:clear-form [2011/05/31 01:22] – [code snippet] banana | study:javascript:jquery:clear-form [2017/11/28 04:26] (現在) – [code snippet] banana |
|---|
| $("input[type='text'], textarea").not("input[readonly='true'], input[type='hidden'], :button, :submit, :reset").val(""); | $("input[type='text'], textarea").not("input[readonly='true'], input[type='hidden'], :button, :submit, :reset").val(""); |
| $("input[type='radio'], input[type='checkbox'], select").removeAttr("checked").removeAttr("selected"); | $("input[type='radio'], input[type='checkbox'], select").removeAttr("checked").removeAttr("selected"); |
| $("select option:first-child").attr("selected", "selected"); | $("select option:first-child").attr("selected", "selected"); // 1.6以前のバージョン |
| | $("select").prop("selectedIndex", "0"); // 1.6以降 |
| } | } |
| } | } |