如果选中了Javascript [英] Javascript if box checked
本文介绍了如果选中了Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有此表格可以添加视频.现在,有一个用于标题"的输入字段,如果您按下复选框"tryout",我希望该字段消失.我应该如何在JS中做到这一点.我使用jquery.
i have this form for adding videos. Now, there's a input field for "title" and i want that to disappear if you have pressed on the checkbox "tryout". How should i do that in JS.. i use jquery.
推荐答案
假设您为两个字段都分配了正确的ID,则可以执行以下操作:
Assuming you have correct ids assigned for both fields something like this will work:
$('#tryout').click(function () {
$('#title').toggle(!$(this).attr('checked'));
});
这篇关于如果选中了Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文