radio button is checked but display not check

im trying to save different value of radio buttons on same name, it works and was able to make checked appear if the correct value is saved.


As you can see on the screenshot ABOVE (which is taken on view-source:), it the correct selected input is CHECKED already however even if it's check you can see on the screenshow BELOW that it doesn't display as checked.


It's already checked but not displaying , i dont know

Topic radio functions metabox html Wordpress

Category Web


Check if you have another group of input radio button with the same name be the issue. Just rename other groups of input radio button with different name, should resove the issue.

In your case name='seasons' should not be used for another radio button group.

Thanks,


Thanks a lot everyone for all your time! I really appreciate it!

I've finally found what's causing it to appear and it's because i forgot to remove the old sets of radio buttons with the same id as that on a different meta box.

I've finally fixed it! Thank you!


In the WordPress back-end you have to use checked="checked" (stricter XHTML), because the CSS will not be applied otherwise:

<input type="radio" name="colors" id="blue" checked="checked">

this is the CSS that applies the blue dot:

enter image description here

WordPress already provides a function for this checked()

<input type="radio" name="colors" id="blue" <?php checked( 'red', get_option( 'color' ) ); ?> />

so you dont have to do an If and echo.


I think you can Also try it checked="checked" some time issue with checked so just try it.

checked

Replace with

checked="checked"

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.