i want to remove class from others radio buttons when i click on radio button in another section with jQuery( used in oxygen builder wordpress).
jQuery(document).ready(function(){
jQuery("div").click(function(){
jQuery("div.volba-1-1 div, div.volba-1-2 div, div.volba-1-3 div").removeClass("ff_item_selected");
});
});
This works fine for me, but if i click somewhere else radio button is still selected but class was removed. Someone help me with this?
website to see my problem:
enter link description here
Thanks
2
Answers
I really couldn’t understand the question, but you should use the click event for the radio buttons only, and not for every div of your page. This line is causing the undesired behaviour:
If there’s any other div on your page and you click it, your function will be triggered. That function should only be triggered when you click on your radio buttons, which you could easily group by using a common class amongst other ways. Then your function should look like this:
Assuming that they all have this "commonClass" class.
I really couldn’t understand the question, but you should use the click event for the radio buttons only, and not for every div of your page. This line is causing the undesired behaviour:
If there’s any other div on your page and you click it, your function will be triggered. That function should only be triggered when you click on your radio buttons, which you could easily group by using a common class amongst other ways. Then your function should look like this:
Assuming that they all have this "commonClass" class.
EDIT:
First, you need to make your desired div’s members of a common class:
Then in your JQuery code:
And that’s it!! with those 2 lines you’ll always have only your selected item with the class ff_item_selected. $(this) keyword will help you a lot when coding in JQuery.