【发布时间】:2016-02-12 12:25:47
【问题描述】:
我有asp:DropDownList,我的要求是当用户从列表中选择其他TextBox 时显示给用户。但最初TextBox 是隐藏的。
我在下面编写代码以在页面加载时隐藏TextBox。
txtOtherArea.Attributes.Add("style", "display:none")
但是当我尝试使用 JQuery 显示这个 TextBox 时,什么也没发生。下面是我的 JQuery 代码。
$(function () {
$("#ddlUserArea").click(function () {
$("#txtOtherArea").fadeIn("slow");
});
});
我也尝试使用show() 而不是fadeIn("slow"),但没有使用show() 方法的选项。
然后我尝试下面的代码来隐藏TextBox。
<script type="text/javascript">
$(function () {
$("#txtOtherArea").fadeOut(1000);
});
</script>
我将上面的代码写在母版页的头部。但是什么也没发生。
我在这个论坛上阅读了其他主题和问题,但不明白可能是因为太复杂了。我是编程新手,只需在用户从DropDownList 中选择其他时显示TextBox。请帮忙。
【问题讨论】:
标签: javascript c# jquery asp.net webforms