I am trying to append a "Please select" option as a first option in a taxonomy select field in a CRED create form with the help of this post:
https://toolset.com/forums/topic/cred-blank-default-value-for-taxonomy-select-field-validation/
But the string
jQuery("select[name='wpcf-rating']").prepend('<option value="">- Select -</option>');
jQuery("select[name='wpcf-rating']")[0].selectedIndex = 0;
gets replaced to
jQuery("select[name='wpcf-rating']").prepend('- Select -');
jQuery("select[name='wpcf-rating']")[0].selectedIndex = 0;
after I save the CRED form. This issue is also outlined here:
https://toolset.com/forums/topic/create-dropdown-from-taxonomy-with-the-option-of-having-blank-value/
As a result the code does not work. What is the problem?
That should work, but unfortunately it hasn't, tag still getting stripped after save!
I just test the codes in my localhost, it works fine, please check these:
1) you are using the latest version of CRED form
2) add the custom PHP codes into your theme/functions.php as the post:
https://toolset.com/forums/topic/javascript-modified-when-saving-cred-form-2/#post-364903
and test again
3) If the problem still exists, please deactivate other plugins and switch to wordpress default theme, and test again.