Skip Navigation

[Resolved] jquery to hide a select option doesn't work in safari

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#2608237

Hi there

I have a select field in a cred form with some jquery to hide some of the options like this:

SELECT FIELD IN THE FORM:

<div id="omit">
[cred_field field='FIELD-SLUG' force_type='field' class='form-control' output='bootstrap' select_text='Select...']
</div>

JQUERY IN THE JS EDITOR BELOW THE FORM EDITOR:

jQuery( document ).ready(function() {
jQuery('#omit select option[value="OPTION-VALUE"]').hide();
jQuery('#omit select option[value="OPTION-VALUE"]').hide();
jQuery('#omit select option[value="OPTION-VALUE"]').hide();
jQuery('#omit select option[value="OPTION-VALUE"]').hide();
});

It works perfectly on Firefox and Chrome but not on Safari... I can't seem to find an answer to this problem... Does anyone by any chance have any advice or thoughts?

Rita

#2608247

Hi Rita,

Thank you for contacting us and I'd be happy to assist.

This is a known limitation of Safari and you'll find many forum threads and articles on this topic online. For example:
hidden link

To overcome this, you can replace the '.hide' function in the script with either the '.detach' or '.remove' function.

Related documentation:
hidden link
hidden link

I hope this helps and please let me know if you need further assistance.

regards,
Waqar

#2608753

Ok great. Thanks Waqar. That resolves the problem. Thank you!