取值
TextBox
alert($("#TextBox3").val());
RadioButtonList
alert($('#<%=RadioButtonList3.ClientID %> input:checked').val());
PS:
$("input[id^='<% =RadioButtonList3.ClientID %>']:checked").val() //用id取值
$("input[name='<% =RadioButtonList3.ClientID %>']:checked").val() //用name取值
DropDownList
alert($("#DropDownList6 option:selected").val()); //取得selected value
alert($("#DropDownList6 option:selected").text()); //取得selected text
設值
TextBox
$("#ctl00_ContentPlaceHolder2_TextBox3").val("測試值");
RadioButtonList
$('#<%=RadioButtonList3.ClientID %>').find("input[value='2']").attr('checked', 'checked');
DropDownList
$("#DropDownList6").val('2'); //設定selected value
$("#DropDownList6 :selected").text("測試值"); //設定selected text
留言列表