当前位置:编程学习 > C#/ASP.NET >>

隐藏

<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怎么让第四个不显示?急、急、急、急、急、急 --------------------编程问答--------------------  怎么没人回啊?急死了 --------------------编程问答-------------------- 不会jquery,没办法!帮你顶了,希望你早点解决! --------------------编程问答-------------------- --------------------编程问答-------------------- 你的Enabled="false"不是已经可以隐藏了吗,你是还想让他显示出来吗? --------------------编程问答-------------------- 要隐藏就先删掉,要全显示再添加项
function remove()
{
 var obj=document.getElementById("option1");
 obj.options.add(new Option("ddd",1));//添加新项
 var index = 0;
 obj.remove(index);//删除指定索引处的项
} --------------------编程问答-------------------- function remove()
{
 var obj=document.getElementById("option1");
 obj.options.add(new Option("ddd",1));//添加新项
 var index = 0;
 obj.remove(index);//删除指定索引处的项
}
这个option1是什么? --------------------编程问答-------------------- 你真该多去学学html了 html标签你不认识吗 select下面是什么 --------------------编程问答-------------------- 我知道select下面是什么但是我不知到var obj=document.getElementById("option1");他写的这个是干什么的
--------------------编程问答--------------------   $("#ddl option").each(function(i) {
                if (i == 3) {
                    //alert(this);
                    $(this).remove();
                }
            }) --------------------编程问答--------------------
引用 5 楼 yangglemu 的回复:
要隐藏就先删掉,要全显示再添加项
function remove()
{
 var obj=document.getElementById("option1");
 obj.options.add(new Option("ddd",1));//添加新项
 var index = 0;
 obj.remove(index);//删除指定索引处的项
}

这样应该成 --------------------编程问答-------------------- 你不想 让他显示。 你干脆不绑定 不就好了。。  --------------------编程问答-------------------- 那个只能删除吧,不能不显示还存在 --------------------编程问答-------------------- $(this).remove();
这个有添加的方法吗? --------------------编程问答-------------------- <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>
看吧 这个可以就给分吧别讨论了 这个没什么讨论的 --------------------编程问答-------------------- 没有结贴的习惯,以后再问谁都不会回答你,
还在此建议CSDN处理一下不结贴数达到什么条件就不能发帖的功能
让这些贪便宜的人少折腾人
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,