متن select را بر نمی گرداند

ashkufaraz

Member
1:
http://stackoverflow.com/questions/5299382/get-current-text-select-runat-server
HTML

<div id="dialog">
<select id="Select1">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</div>

Script

$("#dialog").dialog({ "ok": function () { alert($("#Select1").val()); });


this code Is Correct And Return Current Value.

BUT BUT BUT BUT

2:

HTML

<div id="dialog">
<select runat="server" id="Select1">
<option></option>
</select>
</div >


Script

function par***mlQuestion(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());
}//Fill `Select1`
//add correct information to `Select1`


$("#dialog").dialog({ "ok": function () { `ALERT()` });

Fire 'Ok' Function:

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 .

I like Get Current Text selected.

I think Problem in `runat="server"` in `<select>`
 

جدیدترین ارسال ها

بالا