是否有替代$()。更改? [英] Is there an alternative to $().change?

查看:59
本文介绍了是否有替代$()。更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我试图只在点击一个选择项目之后点击一个按钮,但在想知道为什么下面的代码不起作用我意识到这是因为我没有在表格中使用它。



Hi All,

I am trying to make a button clickable only after a select item is clicked on but after wondering why the below code is not working i realise that it is because i am not using it within a form.

$("#lb1").change(function () {
            if ($("#butDel").attr("disabled", true)) {
                $("#butDel").attr("disabled", false);
            }
        });









有没有其他方法可以用jQuery完成这个过程?



谢谢





我的div







Is there another way i could do this process with jQuery?

Thank You


My div

<div id="dMain"  runat="server">

                  <div id="uPlabels">
                          <label id="userTitle" class="lTitleM"  runat="server">Add/Remove User Access to Application</label>
                  </div>

               <div id="testForm">




                  <div id="dAdminlist">

                       <label id="Label2" class="lBodyMBold"  runat="server">Current user list</label><br /><br />

                           <select id="lb1"
                                runat="server"
                               style="font-family: Verdana,Tahoma,Arial; font-size: 12pt; width: 200px; height: 250px;"
                               size="21">
                           </select>
                       <br />
                 </div>

              <br />


           </div>

      </div>

推荐答案

#lb1)。change(function(){
if
("#lb1").change(function () { if (


#butDel)。attr( disabled true )){
("#butDel").attr("disabled", true)) {

#butDel)。attr( 已禁用 false );
}
});
("#butDel").attr("disabled", false); } });









有没有其他方法可以用jQuery来完成这个过程?



谢谢





我的div







Is there another way i could do this process with jQuery?

Thank You


My div

<div id="dMain"  runat="server">

                  <div id="uPlabels">
                          <label id="userTitle" class="lTitleM"  runat="server">Add/Remove User Access to Application</label>
                  </div>

               <div id="testForm">




                  <div id="dAdminlist">

                       <label id="Label2" class="lBodyMBold"  runat="server">Current user list</label><br /><br />

                           <select id="lb1"
                                runat="server"
                               style="font-family: Verdana,Tahoma,Arial; font-size: 12pt; width: 200px; height: 250px;"
                               size="21">
                           </select>
                       <br />
                 </div>

              <br />


           </div>

      </div>


这篇关于是否有替代$()。更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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