禁用所有具有类名的元素 [英] Disable all any elements who has class name

查看:66
本文介绍了禁用所有具有类名的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我想禁用包含类名pqr的所有元素。



Hi All,

I want to disable all elements who contains class name pqr.

<input class = "abc pqr" id = "txt" type="text">
<input class = "abc pqr" id = "chk" type="checkbox">
<input class = "xyz pqr" id = "file" type="file">
<input class = "abc pqr" id = "date" type="date">
<select class = "abc pqr jkl">
<input class = "pqr" id = "date" type="radio">







如何实现上述目标。



我的尝试:



我尝试过使用attr属性。




How to achieve above things.

What I have tried:

I have tried with attr attribute.

推荐答案


(< span class =code-string> 。abc)。prop( disabled disabled);
(".abc").prop("disabled", "disabled");



.prop()| jQuery API文档 [ ^ ]


这篇关于禁用所有具有类名的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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