Page 1 of 1

I can check/uncheck radio buttons via JS but they don't "look" checked ***SOLVED***

Posted: Sat Mar 24, 2018 5:08 pm
by Astro
I hope this is a good place in the forum to post this question....

I have created a set of 6 radio buttons that trigger an event to load specific tables. I have the buttons spread into 3 different tabs.
I have created events that should select a particular radio button when moving between tabs (as the default for that tab).
Everything is functioning fine but the JS buttons selected by my code do not "appear" checked/unchecked properly.

To clarify, my JS code is "functionally" checking and unchecking my radio buttons but they do not "appear" that way.
When switching tabs, the first button should always be checked. Functionally it is but visually it's not.

I believe it has something to do with "class" of the checked/unchecked state but I have no idea on how to manipulate that using JS or jQuery.

Can someone help me with this or at least point me in the right direction?

Here is the page I'm working on showing the buttons and tabs...
https://publicmissiles.com/PartsTest1.aspx

Again, when switching tabs, the first button should always be checked. Functionally it is but visually it's not. Please help.

---Frank

Re: I can check/uncheck radio buttons via JS but they don't "look" checked

Posted: Sat Mar 24, 2018 6:05 pm
by Pablo

Re: I can check/uncheck radio buttons via JS but they don't "look" checked

Posted: Sat Mar 24, 2018 6:23 pm
by Astro
Pablo wrote: Sat Mar 24, 2018 6:05 pm Maybe this is helpful?
https://www.wysiwygwebbuilder.com/forum ... 10&t=37833
Pablo,
I tried it and it made no difference. Here is the code:

Code: Select all

function TabSwitch2() {
   
    $("#CTbutton").prop("checked", true);     //I tried it here too.
    StripTableAF();doPTFGPT();return true;
    }

Re: I can check/uncheck radio buttons via JS but they don't "look" checked

Posted: Sat Mar 24, 2018 6:29 pm
by Pablo
Ok, in that case I do not know either.
Note that I cannot give support on custom code.

Re: I can check/uncheck radio buttons via JS but they don't "look" checked

Posted: Sat Mar 24, 2018 6:36 pm
by Astro
Pablo wrote: Sat Mar 24, 2018 6:29 pm Ok, in that case I do not know either.
Note that I cannot give support on custom code.
Yes, I understand you can't help with custom code. I'm hoping someone else here may have worked through this issue.

Do you think this is a good question for a jQuery forum, a CSS forum, or a general html forum?

Thanks again!
---Frank

Re: I can check/uncheck radio buttons via JS but they don't "look" checked

Posted: Sat Mar 24, 2018 7:07 pm
by Pablo
I noticed you are using jQuery Button as checkboxes, so maybe you will need to refresh them after changing the value?
http://api.jqueryui.com/checkboxradio/#method-refresh

Re: I can check/uncheck radio buttons via JS but they don't "look" checked

Posted: Sat Mar 24, 2018 7:43 pm
by Astro
Pablo wrote: Sat Mar 24, 2018 7:07 pm I noticed you are using jQuery Button as checkboxes, so maybe you will need to refresh them after changing the value?
http://api.jqueryui.com/checkboxradio/#method-refresh
Pablo,
That was it!
Thank you VERY much. :)

See it work, if you want.....
https://publicmissiles.com/PartsTest1.aspx