Skip to content

Instantly share code, notes, and snippets.

@New0
Last active November 19, 2019 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save New0/2942259b790256d5b5107eb16bbb9323 to your computer and use it in GitHub Desktop.
Save New0/2942259b790256d5b5107eb16bbb9323 to your computer and use it in GitHub Desktop.
//Example of adding a tabindex to radio fields options in Caldera Forms
<?php
/**
* Plugin Name: CF tabindex on radio options
* Autor: New0
* Description: Add tabindex on options of radio fields in CF
*/
//Example of adding a tabindex to radio fields options in Caldera Forms
// If there are multiple radio fields on same page, target each field using the field ID between caldera-grid and radio classes.
//Like ".caldera-grid #fld_8471527_1-wrap .radio label input" replacing #fld_8471527 by the field ID ( and keeping _1-wrap attached).
add_action( 'wp_footer', function() {
echo '<script>
jQuery(".caldera-grid .radio label input").each(function (i) { jQuery(this).attr("tabindex", i + 1); });
</script>';
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment