I can see how your solution works, but there is a semantic element created for exactly what you want: <optgroup>
. Whatever your solution, I’d encourage you to use that instead.
Searching for “contact form 7 optgroup” you’ll discover that other people are looking for the same thing you are and trying to implement <optgroup>
to do it. Here’s one answer that includes both a javascript solution and a plugin hack (probably not a good idea). Probably the better solution I’ve found is this one. It’s a javascript to replace Contact Form 7 select options with the optgroup element using a specified syntax.
That final solution should probably remain stable even if CF7 adds optgroup support down the road.
Related Posts:
- Contact Form 7 plugin refreshing page on submit [closed]
- Contact form 7 select box different value-text than content-text in option [closed]
- How to disable autocomplete for inputs in contact form 7? [closed]
- Download any file after submitting a form [closed]
- Contact Form 7 Get Image Function [closed]
- Is there a way to embed a Google Docs form in a page without using plugins?
- WordPress contact form 7 to show the form dropdown menus as like [closed]
- How do I add the same contact form to multiple wordpress sites and capture the response in one place or database?
- How can I implement radio buttons with icons in Contact form 7?
- Hide button after form submit and save state to localstorage
- How to send custom mail when a user complete a specific form
- get/show Last ID
- Can’t edit Contact Us form on front page
- Plugin Beauty Contact Popup Form with while loop
- how to show selected options drop down menu values in attributes field in after saving post.php
- Issue using form in Google app in mobile
- Missing Contact Form/Form Default Plugin in WordPress
- Why “Contact Form 7” doesn’t update PHPmailer library?
- How to get current post ID in Contact Form 7 wpcf7_before_send_mail hook action
- To Disable WordPress Rest API or Not To Disable?
- Simple form that saves to database
- Let readers suggest edits from the frontend
- Get selected values from checkboxes and radio buttons via Gravity Forms gform_after_submission hook [closed]
- Where should my plugin POST to?
- How can I show drafts in wp_dropdown_pages list?
- Plugin development: how to create a form and get custom data?
- Custom comment type maybe?
- Multi step form, custom plugin
- shortcode doesn’t work
- Template plugin for blog posts? [closed]
- Plugin form unable to process
- Trying to add admin file upload form plugin
- Customize the Sorting Dropdown in WooCommerce
- WordPress Custom Application form
- When is it useful to use wp_verify_nonce
- Datepicker not supporting timepicker
- add function to saving change on Options Pages
- Is there any good tutorial to write custom login, registration and password recovery forms? [closed]
- Server side validation for Contact Form 7 [closed]
- WordPress plugin form not saving data
- Admin page: form with enctype=”multipart/form-data” does not transfer its data
- jQuery Plugin to use WordPress functions in AJAX request
- get values from contact form 7 wp plugin [closed]
- Add custom variable in Contact Form 7 mail body
- Add form fields dynamically on button click
- Can’t send mails using contact plugin [closed]
- How to trigger $_GET request within admin plugin page?
- Retrieving a Value from a wp-database
- Custom CSS for plugin form
- change captcha design in Fast Secure Contact Form plugin
- Form doesn’t submit on second submit call
- WP plugins for building a database?
- Hook into and send mail using WP Mail SMTP type plugin from HTML static front page?
- Custom form action to handle data inside a plugin
- Carrying information from button click into form [closed]
- Retrieving old forms in Contact Form 7 [closed]
- Link Forms on WordPress
- Custom Form only for admin
- Capturing POST data
- County Finder form/plugin?
- Creating fields in the database
- Allow users to enter and edit data in one-to-many configuration
- Undefined variable _POST
- Plugin use of ajax/jquery depending dropdown
- Plugin Admin Page Ajax-Admin call returning 0, URL set correctly. Implemented localized scripts but did not fix it
- How to prevent page load on form submission
- Integrate Mailchimp to a Contact Form 7 contact form [closed]
- How to develop an extension for a simple form post and post back? [closed]
- Output dropdown results into Woocommerce Order details
- How put a file when the email is sent to user contact form 7
- Contact Form 7 Default value from url [closed]
- how to search through plugin in wordpress cimy-user-extra-fields?
- Integrate Razorpay quick payments plugin with contact form7 plugin
- How to do Conact form 7 name field validation? [closed]
- Build a Boat Form Plugin [closed]
- How to get an error message if a form is empty (plugin: Post for site) [closed]
- Is it possible to set different payment gateway on each Gravity Forms form? [closed]
- Contact form 7 – How to send mail to two different E-mail Address [closed]
- prevent contact form 7 from submission on certain condition
- Contact form with dynamic dropdown and filter
- Redirecting to page on form submit – Revue plugin
- How to Allow Users to Select Recipients In a WordPress Comment section?
- WP Donation Form with custom payment API
- Form with response button after on table after submission
- Tips on using a custom template with Ultimate Member
- How can I add a zip code service availability checker in WordPress without Woocommerce? [closed]
- plugin doesn’t retrieve data from database
- Can’t save formdata in DB
- Display file contents within Plugin
- Gravityforms login form custom redirect if form not submitted
- How to make a drop-down list so you can press and change display like on this website by using wordpress or CSS
- i need to resive data external api and show user
- Trying to Find the PHP File/Function that Handles a Specific Form Action URL
- I am trying to add form using ACF plugin and acf_form() function, but my user fields dont show up properly
- How can I create a drawable image for a contact form
- add to cart linking to add to cart page
- Form submission issue in wordpress admin (custom plugin) using $_GET for searching & filtering
- WP Form Date Field – Remove Day option
- Is there a WordPress plugin or solution that allows to set up forms with a total control over markup
- How to verify/test that a custom built wordpress theme is as secure as possible?