yud123

一、 

$(\'#reset\').click(function() {
        $(\'#form\')[0].reset();
    });

$("#form")取得id为form的jQuery对象
$("#form")[0]可以把这个jquery对象转成html对象
后面的.reset()方法不是jquery对象的方法,但是是html对象的方法。

二、

$(function(){
        $("#reset").click(function(){
            $(\':input\',\'#form\')
            .not(\':button,:submit,:reset,:hidden\')
            .val(\'\')
            .removeAttr(\'checked\')
            .removeAttr(\'selected\');
        });
    });

 

分类:

技术点:

相关文章:

  • 2022-02-13
  • 2021-12-06
  • 2022-01-27
  • 2022-12-23
  • 2021-11-24
  • 2021-12-10
猜你喜欢
  • 2021-12-22
  • 2021-12-06
  • 2021-12-04
  • 2022-12-23
  • 2021-06-17
  • 2021-12-06
  • 2021-12-28
相关资源
相似解决方案