jquery 获取 单选、多选、下拉框属性 不是属性值。比如下拉框中有个Enabled属性 我想让这个属性的值="false"。

解决方案 »

  1.   

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                $("#Select1 option").each(function(){
                    alert($(this).attr("selected"))
                })
            })
        </script>
    </head>
    <body>
        <select id="Select1">
            <option>1</option>
            <option selected="selected">2</option>
        </select>
    </body>
    </html>
      

  2.   

    如果你是想隐藏和显示下拉框的话,可以用$("#Select1").show()显示,$("#Select1").hide()隐藏
      

  3.   

     function cke(v)
    {
      v.enable=false;
    }<input type="hidden" value='' onload='cke(this)'>
      

  4.   

     <script>
        jQuery(function($){
        $('select').attr("disabled","false");
        });
    </script>
      

  5.   

    正解: $("#this").attr("disabled", "disabled");
      

  6.   

    这只是一个下拉框的例子,我想知道如何获取其他控件的属性并赋相应的值,就像下拉框失效在脚本中的Enabled属性="false",而在jquery中$("#this").attr("disabled", "disabled");表示才有相同的效果。
      

  7.   

    jQuery(function($){
      $('#其他控件ID').attr("disabled","false");
      });
      

  8.   

    不是只失效这个属性啊,何获取其他控件的其他属性(控件在脚本中能有的,在jQuery中也要有相应的)并赋相应的值,怎么知道在jQuery中的其他属性(脚本中可以用空格键敲一下就知道啦,jQuery中有什么相应的办法)?
      

  9.   

    jquery中的其他属性就是 $('#其他控件ID').attr("js里的其他属性","具体的值");  
      

  10.   

    js里的其他属性 和 jquery中的有的不一样的,比如下拉框失效,在JS中Enabled="false";在jquery中attr("disabled[属性不是Enabled]","false");
      

  11.   

    Enabled  是服务器控件的js里没的吧html控件都是disabled的吧。。
      

  12.   

    如何获取服务器其他控件的其他属性(控件在服务器中能有的,在jQuery中也要有相应的)并赋相应的值,怎么知道在jQuery中的其他属性(服务器中可以用空格键敲一下就知道啦,jQuery中有什么相应的办法)?
      

  13.   

    ..jquery中的属性就是普通html控件的属性呀。。没的提示的。。你看下普通的html控件的属性再写就可以了
      

  14.   

    $("#select1").find("option:selected").each(function(){
      if($(this).get(0).selected){
      $(this).attr("disabled","true")
      }
    })
      

  15.   

    使用true 运行的时候如果选择过false,那么true就不能再用啦,还是false。
      

  16.   

    我的解决方法是将:$(this).attr("disabled","true") 改成$(this).attr("disabled","")。
    这样就OK啦!
      

  17.   

    。。这个$(this).attr("disabled","true") 改成$(this).attr("disabled","")。
    中的属性可以是true,false,disabled,""这几个都是可以的具体也不清楚。。反正我火狐和IE都是可以用的。。
      

  18.   

    怎么知道服务器控件和普通html控件的属性的汉文意思?知道了这个也就知道怎么相应转换了。
    不要告诉我 让我一个个的去试哈。