当我取消勾选复选框时,线应该变得不可见 [英] Line Should Become Invisible When I Untick The Checkbox
本文介绍了当我取消勾选复选框时,线应该变得不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在我的webform上显示一条小垂直线,当我选中一个复选框时,它应该只显示(或变得可见)。当取消勾选复选框时,行应该变得不可见我怎么能这样做?
解决方案
你可以用非常简单的方式做到这一点:
HTML:
< 输入 id = chkTest type = 复选框 / >
< div > 一些文字< / div >
< hr id = horizontalLine / >
< div > 更多文字< / div >
CSS:
# horizontalLine {
display : none;
}
JS:
i want to display a small vertical line on my webform which should only appear(or become visible) when i check a checkbox. Line should become invisible when i untick the checkbox how can i do that?
( #chkTest)。change( function (){
解决方案 You can do it in a very easy way like:
HTML:
<input id="chkTest" type="checkbox" />
<div>Some Text</div>
<hr id="horizontalLine" />
<div>Some More Text</div>
CSS:
#horizontalLine{
display:none;
}
JS:
(function () {
("#chkTest").change(function () {
这篇关于当我取消勾选复选框时,线应该变得不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文