如何在复选框上切换图像 [英] How to toggle an image on a check box
本文介绍了如何在复选框上切换图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要 更改图片 a 检查框在 MVC中,' 现在不能正常工作,下面是代码,有人能告诉我我缺少什么吗?
这是视图文件
< table >
< span class =code-keyword>< tr >
< td >
< div class = btn-group pull-right data-toggle = 按钮 >
< 标签 id = lblStatementCheckBox class = btn btn-p1-navbar active pull-right onclick = ToggleStatementCheckBox(); >
< 输入 id = < span class =code-keyword> btnStatement name = type = 复选框 autocomplete = off >
< span class = glyphicon glyphicon-remove > < / span >
< / label >
< / div >
< / td >
< < span class =code-leadattribute> / tr >
< / table >
function ToggleStatementCheckBox(){
警报(我在这里);
$('#lblStatementCheckBox span.glyphicon')。toggleClass(glyphicon-ok);
}
解决方案
( '#lblStatementCheckBox span.glyphicon')。toggleClass( glyphicon-OK );
}
试试这些链接 -
Customize复选框在ASP.NET [ ^ ]
I need to change an image on a check box in MVC, it's not working now, below is the code, can someone tell me what I am missing?
Here is the view file
<table>
<tr>
<td>
<div class="btn-group pull-right" data-toggle="buttons">
<label id="lblStatementCheckBox" class="btn btn-p1-navbar active pull-right" onclick="ToggleStatementCheckBox();">
<input id="btnStatement" name="" type="checkbox" autocomplete="off">
<span class="glyphicon glyphicon-remove"></span>
</label>
</div>
</td>
</tr>
</table>
function ToggleStatementCheckBox() {
alert("I am in here");
$('#lblStatementCheckBox span.glyphicon').toggleClass("glyphicon-ok");
}
解决方案
('#lblStatementCheckBox span.glyphicon').toggleClass("glyphicon-ok"); }
Try these links -
Customize CheckBox in ASP.NET[^]
这篇关于如何在复选框上切换图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文