How extract text from form element using <option>, Javascript extracts the assigned value, how do I get the text? |
How extract text from form element using <option>, Javascript extracts the assigned value, how do I get the text? |
Ann-Marie Foster |
Aug 5 2018, 12:48 AM
Post
#1
|
Group: Members Posts: 7 Joined: 5-August 18 Member No.: 26,686 |
Here is the COUNTRY input of a checkout form.
CODE HTML:- Country <select NAME="Bill Country" ID="BillCountry" ONCHANGE="UpdateCheckout()"> <option value="US">USA</option> <option value="AF">Afghanistan</option> <option value="AL">Albania</option> <option value="DZ">Algeria</option> <option value="AD">Andorra</option> . . . . . . </select> The above displays a form element where the customer can select their country. java script: document.getElementById("BillCountry").value; Gets the 2 character "Country Code" needed by PayPal. But I would like to also access the TEXT of the particular country selected for printing a summary. After they select a country the full text shows on the form element but HOW DO I EXTRACT THE TEXT? |
Lo-Fi Version | Time is now: 19th April 2024 - 04:58 AM |