<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(document).ready( function() {
$("#e_name").bind({
'click': function() { $("#btnSubmit").removeAttr("disabled"); },
'keyup': function() { $("#btnSubmit").removeAttr("disabled"); }
});
});
</script>
</head><body>
<input id= "e_name" type="text" /><button id="btnSubmit" disabled="disabled">BUTTON</button> 
</body>
</html>

解决方案 »

  1.   


    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="gb2312" />
    <title></title>
    </head>
    <body>
    失焦时禁用,按 ctrl + q 启用
    <input id="test" />
    <script>
    function $(el){
    return typeof el == 'string' ? document.getElementById(el) : el;
    }
    var obj = $('test');
    obj.onblur = function(){
    this.disabled = true;
    }
    document.onkeydown = function(e){
    e = window.event || e; if( e.ctrlKey && e.keyCode == 81 ){
    obj.disabled = false;
    obj.focus();
    }
    }
    </script>
    </body>
    </html>
    这个意思?
      

  2.   

    document.getElementById("btnSubmit").disabled = false;其实我就是想知道把这句话用Jquery写是怎么写,感谢1,2楼的例子。
      

  3.   


    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="gb2312" />
    <title></title>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    </head>
    <body>
    <input type="submit" />
    <script>
    $('input').attr('disabled', true)
    </script>
    </body>
    </html>
      

  4.   


    $('input').请问这个是啥意思呢?
      

  5.   

    jquery的选择器啊
    选择input DOM楼主还是先看看http://www.w3school.com.cn/jquery/jquery_selectors.asp
      

  6.   

    $("#btnSubmit").removeAttr("disabled");
    $("#btnSubmit").attr("disabled",true);