我有一个问题,需要删除使用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] 删除。
我来说两句