473,480 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to get combo value using javascript

1 New Member
[HTML]
<select name="cityName" class="CLiKSformfield" id="IdfbCity" onChange="javascript:addCity(this);">
<option value="ALL">Select Location</option>


<option value="1001"
> Gurgoan</option>

<option value="1002"
> Hyderabad</option>

<option value="1005"
> saicity</option>

<option value="1006"
> ddd</option>

<option value="1008"
> ssss</option>

<option value="1009"
> test</option>

<option value="1010"
> test1</option>

<option value="1">Others</option>
</select>[/HTML]


Here I would like to get the selected combo value if I select "test1" I need the value test1 only.
Oct 25 '07 #1
1 6564
acoder
16,027 Recognized Expert Moderator MVP
Welcome to TSDN!

You're passing a reference to the select element to addCity(). So, in addCity, try:
Expand|Select|Wrap|Line Numbers
  1. function addCity(selObj) {
  2. var val = selObj.options[selObj.selectedIndex].text;
  3. ...
  4. }
PS. removed extra stuff from the thread title.
Oct 25 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
7277
by: Matt | last post by:
The ASP page has a combo box with id list, and when user click the particular id, it will show the name in the text box. My attempt was when the user have event on combo box, it will call...
8
1954
by: rikesh | last post by:
Hi I'm sure this is a very trivial problem! I have a combo bound to a recordset. I was wondering how I can show the value on the page, what the user has selected? The code that I'm using is...
4
8826
by: mr_burns | last post by:
hi, using javascript, how do i select an option in a combo box? i have tried looking on the internet but dont really know what i should be searching for. what i want to happen is that when a...
4
5741
by: Yuk Cheng | last post by:
<<<start index.htm>>> <html> <head> <script> function perform(action){ } </script> </head>
5
17189
by: Harry Haller | last post by:
<select name="cboPlaces" id="cboPlaces"> <option value="3">Countryside</option> <option value="4">Forest</option> <option value="5">Mountain</option> <option value="6">Desert</option> <option...
1
2441
by: The Eclectic Electric | last post by:
I'd be very grateful if anyone could help me with this. From my limited knowledge of Javascript I don't think it is possible, but I'll punt anyway. I downloaded and very slightly adapted this...
0
7037
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6904
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7076
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6730
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6873
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5321
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4767
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1294
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.