Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 5th, 2004, 06:37 PM
Authorized User
 
Join Date: Nov 2003
Location: , , Australia.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Getting select option name not value

Hello,

i have a select statement
<select name ="cars">
  <option value ="1">Ford</option>
  <option value ="2">Holden</option>
  <option value ="3">Nissan</option>
</select>

In my javascript i want to be able to request the name of the selected item (eg Ford) not the value.

Any suggestions would be appreciated

Chris

Reply With Quote
  #2 (permalink)  
Old April 5th, 2004, 07:07 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

var text = document.getElementById('cars').options[document.getElementById('cars').selectedIndex].text;

:)

----------
---Snib---
----------

<><
Reply With Quote
  #3 (permalink)  
Old April 5th, 2004, 10:20 PM
Authorized User
 
Join Date: Nov 2003
Location: , , Australia.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Snib Exactly what i needed
Chris

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need help putting xsl:value-of in select option eruditionist XSLT 2 September 25th, 2008 08:27 AM
wrap a select option nerssi HTML Code Clinic 0 June 16th, 2007 07:43 AM
option selected from a select box Adam H-W Classic ASP Basics 3 December 11th, 2006 11:09 AM
disable Select option Dj Kat HTML Code Clinic 2 March 10th, 2006 04:03 AM
Select/Option Problem TSEROOGY Javascript 2 October 4th, 2004 03:32 PM



All times are GMT -4. The time now is 04:20 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.