简体   繁体   English

jQuery:如何在单击和(重新)加载单选按钮时添加类?

[英]jQuery: How add class on click and (re)load for radio buttons?

how can I customize the jQuery code so that the added class is visible immediately and doesn't disappear on reload?如何自定义 jQuery 代码,以便添加的类立即可见并且不会在重新加载时消失?

Is it necessary to somehow add "click" with an additional "ready"?是否有必要以某种方式添加“点击”并附加“准备好”?

Thanks a lot!非常感谢!

<script type="text/javascript">
$(document).ready(function() {
    $('input').click(function() {
        $('input:not(:checked)').parents('div.options_selection.radio label').removeClass("activearticel");
        $('input:checked').parents('div.options_selection.radio label').addClass("activearticel");
    });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM