Created
July 21, 2022 14:47
-
-
Save vfontjr/9cae8911195273037eab34e8d7d408e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
jQuery(document).ready(function($) { | |
"use strict"; | |
/* self-executing function */ | |
( function($) { | |
/* this function is a workaround for an apparent Firefox bug | |
* where the default values are sometimes not being displayed | |
* the test form works Safari, Chrome, and Firefox Developer Edition. | |
*/ | |
function masterminds_maybe_set_default_radio_values() { | |
/* this code works with radio buttons. It can be modified to work | |
* with other field types | |
*/ | |
if ( ! $('input[id^="field_w3cfrm_post_content_type-"], input[id^="field_w3cfrm_post_content_format-"]').is(':checked') ) { | |
$('input[id="field_w3cfrm_post_content_type-0"]').prop("checked", true); | |
$('input[id="field_w3cfrm_post_content_format-0"]').prop("checked", true); | |
} | |
} | |
masterminds_maybe_set_default_radio_values(); | |
})(jQuery); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment