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
- How to get current post ID in Contact Form 7 wpcf7_before_send_mail hook action
- shortcode doesn’t work
- Template plugin for blog posts? [closed]
- Customize the Sorting Dropdown in WooCommerce
- 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
- jQuery Plugin to use WordPress functions in AJAX request
- Add form fields dynamically on button click
- How to trigger $_GET request within admin plugin page?
- Retrieving a Value from a wp-database
- Custom CSS for plugin form
- WP plugins for building a database?
- Custom form action to handle data inside a plugin
- Image upload and other options in the same plugin settings form?
- Creating an online questionnaire form – by Importing the questions from a spreadsheet?
- Using a custom plugin to capture input data via Ajax and PHP
- How to escape the tailwindcss responsive syntax when using with contact form 7? [closed]
- WordPress WPforms customization
- I want to auto populate data in three fields if one drop down is selected
- Submit page limited in time to upload image
- Ajax fail and get 504 error
- How to insert HTML/JavaScript form into WordPress page? [closed]
- Make a form that will send email to all the authors in selected category [closed]
- How to fetch form data and show it to my page?
- Submit custom form from post content and execute in plugin
- Char limit on custom blog-post form? [closed]
- easy steps to make front end form without plugin
- Form that generates an ID for the customer
- Submit Form data to another page via Ajax (WordPress Way)
- Editing a text file from plugin menu
- Ajax Plugin Not Echoing Response
- Plugin that will output submitted form data for user? [closed]
- How to handle forms from sidebar widgets – Processing $_POST variables using get_field_name()
- Contact Form 7 – Show image on successful send? [closed]
- coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
- Send email to multiple addresses on Contact Form 7, but exclude personal details on all but one
- Contact Form 7 If Condition
- Creating a form and displaying entry data as a table
- Storing The Data Collected by Ninja Forms into Another (custom) Database [closed]
- add_meta_box creating default form field types
- Form Plugin for Api Requests which is used via Shortcode
- Echo out element to another page.
- Add a “default sorting” menu to child store pages
- Select Form Element Not Saving from Plugin Options
- Using AJAX to run SQL statement and populate dropdown
- In wordpress how to sent different email separetly when i click on different email ids [closed]
- How to append new form elements in “Add New” form of Users in WordPress admin panel?
- value not set in contact form 7 plugin of wordpress [closed]
- Looking for a simple checkout plugin [closed]
- Redirect plugin after form submit or show errors
- Making a Contact Form 7 calendar entry “required” [closed]
- Contact Form 7 is not redirecting the “Thank-You” page with the removal of CSS and JS of plugins
- get wpforms ID value from ACF text field
- WordPress – send digital product with custom email
- How to create a form where you can select multiple recipients, based on a list of website users?
- WordPress search input in database, to edit information via form and update the database
- WPForms Custom Redirect not working
- Elementor contact form doesn’t work: “Oops! I cannot send this email!”
- Contact Form 7 – Make a selection unavailable after a number of bookings
- Could someone maybe point me in the direction of a decent tutorial on how to create a wordpress plugin that is compatible with another plugin please?
- Page takes on two different formats
- Create user assessment and use results in sql query
- Adding an onchange event to a custom dropdown menu in WordPress
- Saving custom form fields
- how to create or rewrite files in wordpress plugin folder
- Contact Form 7: custom validation [closed]
- Adding a Filter to Sidbar Login Plugin to Change Login Button Lable
- Create plugin with form in post and submit it to specific form
- Link Forms on WordPress
- Capturing POST data
- Undefined variable _POST
- Plugin use of ajax/jquery depending dropdown
- How to prevent page load on form submission
- How to develop an extension for a simple form post and post back? [closed]
- How put a file when the email is sent to user contact form 7
- 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
- How to Allow Users to Select Recipients In a WordPress Comment section?
- Form with response button after on table after submission
- Tips on using a custom template with Ultimate Member
- plugin doesn’t retrieve data from database
- Can’t save formdata in DB
- Display file contents within Plugin