The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Using JQuery to hide options in a select

Labels

This Discussion is public

Notifications

I developed a website in the past for a client using formidable pro to collect data.  After a few months, the client wanted to remove particular items from a drop down, but keep the existing entries intact. The dropdown field they wanted to be modified was a data from entries field which if the entry was deleted, the items would not stay intact.  I decided that using jquery was the way to keep entries intact.  I pasted the following jquery snippet in the bottom of the customize html field I wanted to hide the options they wanted while keeping existing entries :

 

<script type="text/javascript">
jQuery('#field_25').children('option[value="5"]').css('display','none');
</script>

 

Instead of .css, you can also use

.hide();
or
.attr('disabled','disabled');

Discussion closed.