<select id="Select1">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
alert($("#Select1").val());
this code Is Correct And Return Current Value.
BUT
<select runat="server" id="Select1">
<option></option>
</select>
function parseXmlQuestion(xml)
{
$(xml).find("Question").each(function()
{
var value=$(this).find('Text').text()
$('#<%=Select1.ClientID %>').
append($("<option></option>").
attr("value",value).
text(value));
});
}
alert( $('#<%=Select1.ClientID %>').val());
alert( $('#<%=Select1.ClientID %> option:selected').val());
or
alert( $('#<%=Select1.ClientID %>').text());
alert( $('#<%=Select1.ClientID %> option:selected').val());
or
alert( $('#<%=Select1.ClientID %>').html());
alert( $('#<%=Select1.ClientID %> option:selected').val());
return null or undefined .
u need to remove
<option></option>
fromit should be like
Ok you are a bit weird and you are helping us less each time you answer...
Here is what you should do.
<%=Select1.ClientID %>
which should beSelect1
console.log(value)
oralert(value)
if you haven't evolved yet :)parseXmlQuestion()
should be called somewhere on the page otherwise you just having a sitting duck not being shot or not telling it to run in other words