Set a field as Read Only using jQuery

functions.php

<?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>";
}
No comments yet.

Leave a Reply