javascript - 如何检查 asp :Checkbox is checked and show or hide It using javascript?

标签 javascript jquery asp.net

我的 aspx 页面上有一个 asp:checkbox 和一个 asp:textbox ,我想知道在选中复选框时显示文本框,如果选中则隐藏它使用 javascript 取消选中复选框,我真的很感谢任何可以帮助我的人。

最佳答案

您可以使用此代码

<script type="text/javascript">
function radio_yes(){
if(document.getElementById("c1").checked==true)
        document.getElementById("atext").style.visibility="visible";
        else
        document.getElementById("atext").style.visibility="hidden";}
</script>
<input type="checkbox" id = "c1" name="subscriptions" onclick = "radio_yes();radio_uncheck();"  value="CorporateEmails"/>
    Corporate Press Release Emails<br />
<input type="text" id="atext">

关于javascript - 如何检查 asp :Checkbox is checked and show or hide It using javascript?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13216654/

相关文章:

c# - 返回基于 int 的字符串

确认消息框中的 ASP.NET MVC ViewBag

asp.net - ASP.net AJAX 保存后 onclick 事件不起作用

javascript - JQuery 根据所选选项将Class 添加到元素

Jquery Mobile 禁用固定标题上的样式

javascript 图像翻转

javascript - jQuery 元素上的加减等于不起作用。为什么?

javascript - 阻止浏览器缓存 AJAX 请求

javascript - Rails 5 - Rails-ujs 已经加载

javascript - AngularJS Bootstrap - 控制台错误