Extracting Only the Value (Not Label) from the Selected “Select” Option

I am currently developing a WordPress website for a university using the Forminator plugin. I have a specific requirement related to extracting the value (not the label) from a selected “select” option, and I would greatly appreciate your assistance in resolving this matter.

Here are the details of the issue I am facing:

  1. Extracting Only the Value from the Selected Option: I am utilizing the “select” field within Forminator to allow users to choose from various options. However, my specific requirement is to retrieve a tag with only the value associated with the selected option, not the label.

For example, in the code:

<option value="1">Discipline A</option> 
<option value="2">Discipline B</option> 
<option value="3">Discipline C</option>

When a user selects “Discipline B,” I need to capture the value “2” exclusively, disregarding the label “Discipline B.”

Considering this requirement, I kindly request your guidance on achieving the following:

  1. Suggesting a method or tag that enables me to extract only the value associated with the selected “select” option, without including the label.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer