取值

 

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

arrow
arrow
    全站熱搜

    adamschen9921 發表在 痞客邦 留言(0) 人氣()