如何使用jQuery删除元素所必需的?

Pi Network加密货币

我有一个问题,需要删除使用jQuery的元素。

例如下面的编码,我想required在类中删除,但是jquery不起作用:

<div class="form-group" id="hidden_other" style="display:none;">
<input class="form-control required"  id="other_model" name="other_model" title="Other Model" placeholder="Please fill in other model">
</div>

jquery

$("#other_model").removeAttr("required");

希望有人可以指导我如何解决它。谢谢。

光谱的

您在寻找removeClass(class)方法,而不是removeAttr(attr)方法。这应该可以解决问题:

$("#other_model").removeClass("required")

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章