/*è·å¾TEXT.AREATEXTçå¼*/
var textval = $("#text_id").attr("value");
//æè
var textval = $("#text_id").val();
/*è·ååéæé®çå¼*/
var valradio = $("input[@type=radio][@checked]").val();
/*è·åä¸ç»å为(items)çradio被éä¸é¡¹çå¼*/
var item = $('input[@name=items][@checked]').val();
/*è·åå¤éæ¡çå¼*/
var checkboxval = $("#checkbox_id").attr("value")ï¼
/*è·åä¸æå表çå¼*/
var selectval = $('#select_id').val();
//ææ¬æ¡ï¼ææ¬åºåï¼
$("#text_id").attr("value",'');//æ¸
空å
容
$("#text_id").attr("value",'test');//å¡«å
å
容
//å¤éæ¡checkboxï¼
$("#chk_id").attr("checked",'');//使å
¶æªå¾é
$("#chk_id").attr("checked",true);//å¾é
if($("#chk_id").attr('checked')==true) //å¤ææ¯å¦å·²ç»éä¸
//åéç»radioï¼
$("input[@type=radio]").attr("checked",'2');//设置value=2ç项ç®ä¸ºå½åéä¸é¡¹
//ä¸ææ¡selectï¼
$("#select_id").attr("value",'test');//设置value=testç项ç®ä¸ºå½åéä¸é¡¹
$("<option value='test'>test</option><option value='test2'>test2</option>").appendTo("#select_id")//æ·»å ä¸ææ¡çoption
$("#select_id").empty()ï¼//æ¸
空ä¸ææ¡
è·åä¸ç»å为(items)çradio被éä¸é¡¹çå¼
var item = $('input[@name=items][@checked]').val();//è¥æªè¢«éä¸ åval() = undefined
è·åselect被éä¸é¡¹çææ¬
var item = $("select[@name=items] option[@selected]").text();
selectä¸ææ¡ç第äºä¸ªå
ç´ ä¸ºå½åéä¸å¼
$('#select_id')[0].selectedIndex = 1;
radioåéç»ç第äºä¸ªå
ç´ ä¸ºå½åéä¸å¼
$('input[@name=items]').get(1).checked = true;
//é置表å
$("form").each(function(){
.reset();
});
温馨提示:内容为网友见解,仅供参考