如果一个单选按钮被ckecked,则阻止按钮Click事件的CausesValidation [英] Preventing CausesValidation on button Click event if one radio button is ckecked

查看:52
本文介绍了如果一个单选按钮被ckecked,则阻止按钮Click事件的CausesValidation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的页面上有2个ID为rdoYes和rdoNo的收音机按钮,然后我想要的是如果选中带有id rdoYes的单选按钮,那么当用户单击按钮不应该导致我的页面上的验证(具有RequeiredFieldvalidator)

这是我正在使用的这段代码,但它无法正常工作,它仍然会导致验证:



$(btnContinue)。点击(函数(e){

if($(#<%= rdoYes.ClientID%> ).attr(''checked'',''checked''))

e.preventDefault();

});



顺便说一句,btnContinue是导致验证OnClick事件的按钮的ID。



帮助!

Hi,
I have 2 radio Buttons with IDs rdoYes and rdoNo on my Page,
then what I want is if radio button with id rdoYes is checked then when the user Click on the button it should not causes Validation on my page(has RequeiredFieldvalidator)
This is this code I am using but it is not working,it is still causing validation:

$("btnContinue").click(function(e) {
if ($("#<%=rdoYes.ClientID %>").attr(''checked'', ''checked''))
e.preventDefault();
});

By the way btnContinue is the ID of the button that causesvalidation OnClick event.

Help!

推荐答案

(btnContinue)。点击(函数(e){

if(
("btnContinue").click(function(e) {
if (


(#<%= rdoYes .ClientID%>)。attr(''checked'',''checked''))

e.preventDefaul t();

});



顺便说一句,btnContinue是导致验证OnClick事件的按钮的ID。



帮助!
("#<%=rdoYes.ClientID %>").attr(''checked'', ''checked''))
e.preventDefault();
});

By the way btnContinue is the ID of the button that causesvalidation OnClick event.

Help!


也许你可以在btnContinue标签上添加一个属性 -



maybe you can add an attribute to the btnContinue tag -

clientidmode="Static"





看看它是否适合



see if it woks


这篇关于如果一个单选按钮被ckecked,则阻止按钮Click事件的CausesValidation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆