Created
June 7, 2019 11:10
-
-
Save wpmonks/77ee8c8de3be528e47fc35c536ee159c to your computer and use it in GitHub Desktop.
Disable a form field to stop users input data.
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
/** | |
* Disable form fields to make read-only | |
* To apply, add CSS class 'wpmonks-readonly' (no quotes) to field in form builder | |
* | |
*/ | |
function wpmonks_disable_field() { | |
?> | |
<script type="text/javascript"> | |
jQuery(function($) { | |
$(".wpmonks-readonly input").attr("readonly", true); | |
}); | |
</script> | |
<?php | |
} | |
add_action( 'wpforms_wp_footer', 'wpmonks_disable_field' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment