开发者

Radio Input check or uncheck

开发者 https://www.devze.com 2023-03-10 00:08 出处:网络
I have a form that contains some Checkboxes and one Radio. The problem is that all the Checkboxes are controlled by a jQuery code to change the style.

I have a form that contains some Checkboxes and one Radio.

The problem is that all the Checkboxes are controlled by a jQuery code to change the style.

Every checkbox in that form will be styled because the jQuery code.

But I was in need to have only one checkbox not styled. So I had to use a Radio.

I ha开发者_Python百科ve only one Radio, and I need to find a function to check/uncheck it as it was a normal checkbox.

Is this possible? I run jQuery 1.3.2


This is an abuse of radio buttons and subverts their purpose. Instead of breaking the user interface to fit your needs, simply add in some conditional logical to exempt your special checkbox from the styling rules. In pseudo-code:

if (checkbox.name != 'exempt me') {
    apply_style();
} else {
    do_something_special();
}


The question is phrased in a very confusing way but I think you are asking how, from javascript, to set whether a radiobutton is checked or not.

You can set myRadioButton.checked = false; or myRadioButton.checked = true;

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号