开发者

reset a form to the default values

开发者 https://www.devze.com 2023-01-14 01:52 出处:网络
Currently I have: $(\"#your_email\").val(this.defaultValue;) I want to be开发者_运维百科 cycling through all form elements and resetting them to their default valueyou don\'t need jQuery for this,

Currently I have:

$("#your_email").val(this.defaultValue;)

I want to be开发者_运维百科 cycling through all form elements and resetting them to their default value


you don't need jQuery for this, just get the form dom element and call reset() on it.

Or, fetch with jQuery like:

$("#myFormId")[0].reset();
0

精彩评论

暂无评论...
验证码 换一张
取 消