<script type="text/javascript">
$(function () {
$("[id*=btnSave]").bind("click", function () {
debugger;
var user = {};
user.Projectname = $('#select-comm-type').find("option:selected").text();
user.Emailid = $("[id*=Emailtext]").val();
$.ajax({
type: "POST",
url: "FrmTmsClient.aspx/SaveEmail",
data: '{user: ' + JSON.stringify(user) + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
alert("EmailId has been added successfully.");
window.location.reload();
}
});
return false;
});
});
</script>
user.Projectname中的仅从select = select-comm-type中选择第一个选项。我想要选择其他选项。
答案 0 :(得分:0)
对于
的选定值jQuery("#select-comm-type option:selected").val();
或
$("#select-comm-type option:selected").val();
和
选择文字
jQuery("#select-comm-type option:selected").text();
或
$("#select-comm-type option:selected").text();
更多详情: