jquery中通过添加readonly或者disabled属性实现行为禁止 / 去除某个属性的方法

本文介绍如何使用jQuery来设置和移除HTML元素的属性,包括禁用按钮和文本框的功能,并通过实例展示了如何在页面加载完成后进行这些操作。
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>ajax file</title>
    <script src="./js/jquery-1.12.4.min.js"></script>
    <script>
        $(function(){
            // 设置禁止点击
            $(".butt").attr("disabled","disabled")
            $(".ck").attr('readonly',"readonly")
            // 去除某个属性
            $(".buu").removeAttr("disabled")
        });
    </script>
</head>
<body>
    <div class="box" a="">
        嘿嘿
    </div>
    <input class="ck" type="text" value="嘿嘿">
    <button class='butt'>按钮</button>
    <button class='buu' disabled="disabled">按钮2</button>
</body>
</html>

 

转载于:https://www.cnblogs.com/lowmanisbusy/p/9048804.html

" <p> </p> <table id="41" class="dynamicTable" style="margin: 20px auto; width: 100.03%; height: 32.963px;" border="1" cellspacing="0" cellpadding="0" align="center"> <thead> <tr style="height: 22.963px;"> <th style="padding: 8px; background-color: #ffffff; width: 12.6738%; height: 22.963px;">物料编码</th> <th style="padding: 8px; background-color: #ffffff; width: 12.6738%; height: 22.963px;">物料名称</th> <th style="padding: 8px; background-color: #ffffff; width: 7.69906%; height: 22.963px;">品牌</th> <th style="padding: 8px; background-color: #ffffff; width: 12.6738%; height: 22.963px;">规格型号</th> <th style="padding: 8px; background-color: #ffffff; width: 7.69906%; height: 22.963px;">单位</th> <th style="padding: 8px; background-color: #ffffff; width: 7.69906%; height: 22.963px;">数量</th> <th style="padding: 8px; background-color: #ffffff; width: 18.2408%; height: 22.963px;">单价(RMB)</th> <th style="padding: 8px; background-color: #ffffff; width: 20.6098%; height: 22.963px;">总金额(RMB)</th> </tr> </thead> <tbody> <tr style="height: 10px;"> <td id="materialCode" style="padding: 8px; background-color: #ffffff; width: 12.6738%; height: 10px;">96_10132182_01</td> <td id="materialName" style="padding: 8px; background-color: #ffffff; width: 12.6738%; height: 10px;">螺丝垫片</td> <td id="brand" style="padding: 8px; background-color: #ffffff; width: 7.69906%; height: 10px;"></td> <td id="planModel" style="padding: 8px; background-color: #ffffff; width: 12.6738%; height: 10px;"></td> <td id="units" style="padding: 8px; background-color: #ffffff; width: 7.69906%; height: 10px;">个</td> <td id="winBidCount" style="padding: 8px; background-color: #ffffff; width: 7.69906%; height: 10px;">10</td> <td id="taxExclusivePrice" style="padding: 8px; background-color: #ffffff; width: 18.2408%; height: 10px;">16</td> <td id="taxExclusiveAmount" style="padding: 8px; background-color: #ffffff; width: 20.6098%; height: 10px;">160</td> </tr> </tbody> </table> <p>合同总金额(小写):<input id="2504" name="无税总金额,noTaxExclusiveAmount" type="text" value="160.00000" disabled=""></p> <p>合同总金额(大写):<input id="2505" name="无税总金额(大写),noTaxExclusiveBigAmount" type="text" value="壹佰陆拾元" disabled=""><input id="0.9696365038391399" class="custominput" style="width: auto; min-width: 100px;" type="text" value=""></p> "去除 input的disabled
08-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值