views:

16

answers:

1

Hello everyone, I need to get the selected value from an ajax.net combobox throught javascript so that I can do some client side validation.

What's the best way to do this? Thanks,


I've been able to get the value with this:

var combo = $get('ddlComarcas');
var comboHidden = $get('ddlComarcas_HiddenField');
var o4 = combo.getElementsByTagName('li')[comboHidden.value].childNodes[0];

alert('"' + o4.data + '"');

But I still need to trim the value from o4.data. Anyone can point how to do that visual studio 2008 jquery?

A: 

You can use jQuery or just use DOM:

jQuery:

var selection = $('#selectID').val();

DOM:

var selection = document.getElementById("selectID").value;

asp.net -> server side

javascript -> client side

Marc
Thanks but your solution doesn't work. The combobox from the ajaxtoolkit is made up of 3 inputs. I can't get the value with that.