Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vfontjr/9cae8911195273037eab34e8d7d408e6 to your computer and use it in GitHub Desktop.
Save vfontjr/9cae8911195273037eab34e8d7d408e6 to your computer and use it in GitHub Desktop.
<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