我有2个按钮和2个单选按钮
纽扣
1)btnErp
2)btngoogle
单选按钮
1)rdiogoogle
2)rdioErp
如果我单击rdiogoogle,则btngoogle应该可见,而btnerp应该是隐藏的;如果我单击rdioerp,则btnerp应该是可见的,而btngoogle应该是隐藏的
我做了下面的代码,但是没有用
jQuery的
<script>
$(document).ready(function () {
$("#btnerp").hide();
$("#rdiogoogle").click(function () {
$("#btngoogle").show();
$("#btnerp").hide();
});
$("#rdioerp").click(function () {
$("#btngoogle").hide();
$("#btnerp").show();
});
});
</script>
**HTML**
<div style="margin-top:20px;" class="spaceradio">
<span>
<input type="radio" id="rdiogoogle" name="logintype" value="Google Login" /><span style="font-weight:bold; font-size:17px; font-family:Verdana; margin-left:20px; color:black;">Google Login</span>
</span>
</div>
<div style="margin-top:20px;" class="spaceradio spacer">
<span>
<input type="radio" id="rdioerp" name="logintype" value="ERP Login" /><span style="font-weight:bold; font-size:17px; font-family:Verdana; margin-left:20px; color:black;">ERP Login</span>
</span>
</div>
<div class="imagediv" style="">
<input id="btngoogle" type="image" src="~/Images/google-logo-new.png" alt="Google Login" width="100" height="34" class="btnspacer" />
<input id="btnerp" type="button" class="btn btn-default btnspacererp" style="visibility:hidden;" width="200" height="34" value="Login" />
</div>
您需要在代码中使用其他逻辑,请尝试以下操作:
$(document).ready(function () {
$("input[name=logintype]").change(function(){
if($("#rdiogoogle").is(':checked')){
$("#btgoogle").show();
$("#btnerp").hide();
}else if($("#rdioerp").is(':checked')){
$("#btngoogle").hide();
$("btnerp").show();
}
});
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句