使用jQuery删除html5必需属性 [英] Removing html5 required attribute with jQuery

查看:80
本文介绍了使用jQuery删除html5必需属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用jquery删除'required ='属性。

Hi I would like to remove the 'required=""' attribute with jquery.

<input 
   type="text" 
   id="edit-submitted-first-name" 
   name="submitted[first_name]" 
   value="" 
   size="30" 
   maxlength="128" 
   required=""
>


推荐答案

只是:

$('#edit-submitted-first-name').removeAttr('required');​​​​​

如果您有兴趣进一步阅读,请看看这里

If you're interested in further reading take a look here.

这篇关于使用jQuery删除html5必需属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆