wpform deactivate disable field

PHOTO EMBED

Sun Oct 24 2021 22:44:08 GMT+0000 (Coordinated Universal Time)

Saved by @khalidlogi #php

/**
 * Make standard form fields to make read-only
 * To apply, add CSS class 'wpf-disable-field' (no quotes) to field in form builder
 *
 * @link https://wpforms.com/developers/disable-a-form-field-to-prevent-user-input/
 *
 */
function wpf_dev_disable_field() {
    ?>
    <script type="text/javascript">
 
    jQuery(function($) {
            $('.wpf-disable-field input, .wpf-disable-field textarea').attr('readonly','readonly');
 
    });
 
    </script>
    <?php
}
add_action( 'wpforms_wp_footer_end', 'wpf_dev_disable_field', 30 );

css

input#wpforms-2228-field_14 {
    background-color: beige;
    color: gainsboro;
}
content_copyCOPY