<asp:DropDownList ID="ddl" runat="server">
        <asp:ListItem Value="1" Text="1"></asp:ListItem>
        <asp:ListItem Value="2" Text="2"></asp:ListItem>
        <asp:ListItem Value="3" Text="3"></asp:ListItem>
        <asp:ListItem Value="4" Text="4" Enabled="false"></asp:ListItem>
</asp:DropDownList>通过jquery怎么让第四个不显示?急、急、急、急、急、急

解决方案 »

  1.   

    不会jquery,没办法!帮你顶了,希望你早点解决!
      

  2.   

    你的Enabled="false"不是已经可以隐藏了吗,你是还想让他显示出来吗?
      

  3.   

    要隐藏就先删掉,要全显示再添加项
    function remove()
    {
     var obj=document.getElementById("option1");
     obj.options.add(new Option("ddd",1));//添加新项
     var index = 0;
     obj.remove(index);//删除指定索引处的项
    }
      

  4.   

    function remove()
    {
     var obj=document.getElementById("option1");
     obj.options.add(new Option("ddd",1));//添加新项
     var index = 0;
     obj.remove(index);//删除指定索引处的项
    }
    这个option1是什么?
      

  5.   

    你真该多去学学html了 html标签你不认识吗 select下面是什么
      

  6.   

    我知道select下面是什么但是我不知到var obj=document.getElementById("option1");他写的这个是干什么的
      

  7.   

      $("#ddl option").each(function(i) {
                    if (i == 3) {
                        //alert(this);
                        $(this).remove();
                    }
                })
      

  8.   

    $(this).remove();
    这个有添加的方法吗?
      

  9.   

    <script type="text/javascript">
    $(function(){
    var temp;
        $("#btnHide").click(function(){
            temp = $("#op4");
            $("#op4").remove();
        })
        $("#btnShow").click(function(){
            $("#ddl").append(temp);
        })
    })
    </script>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:DropDownList ID="ddl" runat="server">
                <asp:ListItem Value="1" Text="1"></asp:ListItem>
                <asp:ListItem Value="2" Text="2"></asp:ListItem>
                <asp:ListItem Value="3" Text="3"></asp:ListItem>
                <asp:ListItem Value="4" ID="op4" Text="4" Enabled="true"></asp:ListItem>
            </asp:DropDownList>
            <input type="button" value="隐藏" id="btnHide" />
            <input type="button" value="显示" id="btnShow" />
        </div>
        </form>
    </body>
    </html>
    看吧 这个可以就给分吧别讨论了 这个没什么讨论的
      

  10.   

    没有结贴的习惯,以后再问谁都不会回答你,
    还在此建议CSDN处理一下不结贴数达到什么条件就不能发帖的功能
    让这些贪便宜的人少折腾人