jquery reset的正确用法

  杨宗威   2018-11-16 11:02:46  0  449  
关注 喜欢 鲜花 收藏 评论

[html] view plain copy
 
 
 
  1. <form id="test">  
  2. <input type="text" />  
  3. </form>  

 

重置表单的方法:

错误写法:

 

[html] view plain copy
 
 
 
  1. $('#test').reset();  

这也是在JS里的正确写法,但是在jquery里却不能这么用,要注意

正确用法:

 

[html] view plain copy
 
 
 
  1. $('#test')[0].reset();  

评论
请先登录后再发布评论
全部评论