单击时禁用按钮 [英] Disable button on click

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

问题描述

我有多人应用按钮的形式,每个按钮都有uniq id



< button class =btntype =按钮id =@ item.JobId'_Apply'name =actiononclick =Apply(@ item.JobId,'@ item.DesignationName')>申请
< / button>







按钮点击我想禁用特定按钮





但现在不行了



我尝试了什么:



 $(#+ id +_ Apply)。attr(disabled,true); 
$(this).attr(disabled,true);

解决方案

(#+ id +_ Apply)。attr(disabled,true);


(this).attr(disabled,true);


将按钮对象( this )传递给应用方法

 onclick =  申请( this ,@ item.JobId,'@ item.DesignationName')> 





  function  Apply(obj,jobId,designationName){
obj.disabled = ;
// 您的代码
}


i have form where multiople apply button and have uniq id for every button

<button class="btn " type="button" id="@item.JobId'_Apply'" name="action" onclick="Apply(@item.JobId,'@item.DesignationName')"> Apply
                                   </button>




button click i want to disable perticular button


but it's not work now

What I have tried:

 $("#" + id + "_Apply").attr("disabled", true);
$(this).attr("disabled", true);

解决方案

("#" + id + "_Apply").attr("disabled", true);


(this).attr("disabled", true);


pass the button object (this) to the Apply method

onclick="Apply(this,@item.JobId,'@item.DesignationName')">



function Apply(obj, jobId, designationName) {
            obj.disabled = true;
            // your code
        }


这篇关于单击时禁用按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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