Created
June 16, 2016 15:23
-
-
Save tripflex/357c22f5afa9d0bee54b61939cc69276 to your computer and use it in GitHub Desktop.
Set a field as Read Only using jQuery
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
<?php | |
add_action( 'submit_job_form_start', 'my_custom_jquery_set_field_readonly' ); | |
function my_custom_jquery_set_field_readonly(){ | |
/** | |
* Replace FIELD_META_KEY with the meta key of the field you want to set as readonly. | |
* If you want to set it as disabled instead, just change 'readonly' to 'disabled' | |
*/ | |
echo "<script>jQuery(function($){ $('#FIELD_META_KEY').prop('readonly', true); });</script>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment