hello,
I would like a default value for :
[cred_field field='category' force_type='taxonomy' output='bootstrap' display='select' single_select='true']
It's possible ?
Thank you
Hi,
Thank you for contacting us and I'd be happy to assist.
The 'cred_field' shortcode doesn't support setting a default value for the taxonomy field.
To set a default value, custom script can be used, as explained in this other support thread:
https://toolset.com/forums/topic/cred-blank-empty-default-value-for-taxonomy-select-field/
regards,
Waqar
I try thus but it doesn't work.
jQuery(document).ready(function($) {
jQuery("select[name='news[]']").prepend('<option value="">- Select -</option>');
jQuery("select[name='news[]']")[0].selectedIndex = 0;
jQuery("select[name='news[]']").attr("required","");
});
Thank you
Can you please share the link to the page where this script is not working?
Thank you for sharing the link.
If your goal is to preselect the option 'News' (option value '43'), you can replace that custom script with:
jQuery(document).ready(function($) {
jQuery('select[name="category[]"] option[value="43"]').prop('selected', true);
});