//±éÀúoptionºÍÌí¼Ó¡¢ÒƳýoption
function changeShipMethod(shipping){
var len = $("select[@name=ISHIPTYPE] option").length
if(shipping.value != "CA"){
$("select[@name=ISHIPTYPE] option").each(function(){
if($(this).val() == 111){
$(this).remove();
}
});
}else{
$("<option value='111'>UPS Ground</option>").appendTo($("select[@name=ISHIPTYPE]"));
}
}
//È¡µÃÏÂÀÑ¡µ¥µÄÑ¡È¡Öµ
$('#testSelect option:selected').text();
»ò$("#testSelect").find('option:selected').text();
»ò$("#testSelect").val();
//////////////////////////////////////////////////////////////////
¼ÇÐÔ²»ºÃµÄ¿ÉÒÔÊÕ²ØÏ£º
1,ÏÂÀ¿ò:
var cc1 = $(".formc select[@name='country'] option[@selected]").text(); //µÃµ½ÏÂÀ²Ëµ¥µÄÑ¡ÖÐÏîµÄÎı¾(×¢ÒâÖмäÓпոñ)
var cc2 = $('.formc select[@name="country"]').val(); //µÃµ½ÏÂÀ²Ëµ¥µÄÑ¡ÖÐÏîµÄÖµ
var cc3 = $('.formc select[@name="country"]').attr("id"); //µÃµ½ÏÂÀ²Ëµ¥µÄÑ¡ÖÐÏîµÄIDÊôÐÔÖµ
$("#select").empty();//Çå¿ÕÏÂÀ¿ò//$("#select").html('');
$("<option value='1'>1111</option>").appendTo("#select")//Ìí¼ÓÏÂÀ¿òµÄoption
ÉÔ΢½âÊÍÒ»ÏÂ:
1.select[@name='country'] option[@selected] ±íʾ¾ßÓÐname ÊôÐÔ£¬
²¢ÇÒ¸ÃÊôÐÔֵΪ'country' µÄselectÔªËØ ÀïÃæµÄ¾ßÓÐselected ÊôÐÔµÄoption ÔªËØ£»
¿ÉÒÔ¿´³öÓÐ@¿ªÍ·µÄ¾Í±íʾºóÃæ¸úµÄÊÇÊôÐÔ¡£
2,µ¥Ñ¡¿ò:
$("input[@type=radio][@checked]").val(); //µÃµ½µ¥Ñ¡¿òµÄÑ¡ÖÐÏîµÄÖµ(×¢ÒâÖмäûÓпոñ)
$("input[@type=radio][@value=2]").attr("checked",'checked'); //ÉèÖõ¥Ñ¡¿òvalue=2µÄΪѡÖÐ״̬.(×¢ÒâÖмäûÓпոñ)
3,¸´Ñ¡¿ò:
$("input[@type=checkbox][@checked]").val(); //µÃµ½¸´Ñ¡¿òµÄÑ¡ÖеĵÚÒ»ÏîµÄÖµ
$("input[@type=checkbox][@checked]").each(function(){ //ÓÉÓÚ¸´Ñ¡¿òÒ»°ãÑ¡ÖеÄÊǶà¸ö,ËùÒÔ¿ÉÒÔÑ»·Êä³ö
alert($(this).val());
});
$("#chk1").attr("checked",'');//²»´ò¹´
$("#chk2").attr("checked",true);//´ò¹´
if($("#chk1").attr('checked')==undefined){} //ÅжÏÊÇ·ñÒѾ´ò¹´
µ±È»jqueryµÄÑ¡ÔñÆ÷ÊÇÇ¿´óµÄ. »¹Óкܶ෽·¨.
<script src="jquery-1.2.1.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
$("#selectTest").change(function()
{
//alert("Hello");
//alert($("#selectTest").attr("name"));
//$("a").attr("href","xx.html");
//[removed].href="xx.html";
//alert($("#selectTest").val());
alert($("#selectTest option[@selected]").text());
$("#selectTest").attr("value", "2");
});
});
</script>
<a href="#">aaass</a>
<!--ÏÂÀ¿ò-->
<select id="selectTest" name="selectTest">
<option value="1">11</option>
<option value="2">22</option>
<option value="3">33</option>
<option value="4">44</option>
<option value="5">55</option>
<option value="6">66</option>
</select>
jquery radioÈ¡Öµ£¬checkboxÈ¡Öµ£¬selectÈ¡Öµ£¬radioÑ¡ÖУ¬checkboxÑ¡ÖУ¬selectÑ¡ÖУ¬¼°ÆäÏà¹Ø»ñÈ¡Ò»×éradio±»Ñ¡ÖÐÏîµÄÖµ
var item = $('input[@name=items][@checked]').val();
»ñÈ¡select±»Ñ¡ÖÐÏîµÄÎı¾
var item = $("select[@name=items] option[@selected]").text();
selectÏÂÀ¿òµÄµÚ¶þ¸öÔªËØΪµ±Ç°Ñ¡ÖÐÖµ
$('#select_id')[0].selectedIndex = 1;
radioµ¥Ñ¡×éµÄµÚ¶þ¸öÔªËØΪµ±Ç°Ñ¡ÖÐÖµ
$('input[@name=items]').get(1).checked = true;
»ñÈ¡Öµ£º
Îı¾¿ò£¬Îı¾ÇøÓò£º$("#txt").attr("value")£»
¶àÑ¡¿òcheckbox£º$("#checkbox_id").attr("value")£»
µ¥Ñ¡×éradio£º $("input[@type=radio][@checked]").val();
ÏÂÀ¿òselect£º $('#sel').val();
¿ØÖÆ±íµ¥ÔªËØ£º
Îı¾¿ò£¬Îı¾ÇøÓò£º$("#txt").attr("value",'');//Çå¿ÕÄÚÈÝ
$("#txt").attr("value",'11');//Ìî³äÄÚÈÝ
¶àÑ¡¿òcheckbox£º $("#chk1").attr("checked",'');//²»´ò¹´
$("#chk2").attr("checked",true);//´ò¹´
if($("#chk1").attr('checked')==undefined) //ÅжÏÊÇ·ñÒѾ´ò¹´
µ¥Ñ¡×éradio£º $("input[@type=radio]").attr("checked",'2');//ÉèÖÃvalue=2µÄÏîĿΪµ±Ç°Ñ¡ÖÐÏî
ÏÂÀ¿òselect£º $("#sel").attr("value",'-sel3');//ÉèÖÃvalue=-sel3µÄÏîĿΪµ±Ç°Ñ¡ÖÐÏî
$("<optionvalue='1'>1111</option><optionvalue='2'>
2222</option>").appendTo("#sel")//Ìí¼ÓÏÂÀ¿òµÄoption
$("#sel").empty()£»//Çå¿ÕÏÂÀ¿ò
»ñÈ¡Ò»×éradio±»Ñ¡ÖÐÏîµÄÖµ
var item = $('input[@name=items][@checked]').val();
»ñÈ¡select±»Ñ¡ÖÐÏîµÄÎı¾
var item = $("select[@name=items] option[@selected]").text();
selectÏÂÀ¿òµÄµÚ¶þ¸öÔªËØΪµ±Ç°Ñ¡ÖÐÖµ
$('#select_id')[0].selectedIndex = 1;
radioµ¥Ñ¡×éµÄµÚ¶þ¸öÔªËØΪµ±Ç°Ñ¡ÖÐÖµ
$('input[@name=items]').get(1).checked = true;
»ñÈ¡Öµ£º
Îı¾¿ò£¬Îı¾ÇøÓò£º$("#txt").attr("value")£»
¶àÑ¡¿òcheckbox£º$("#checkbox_id").attr("value")£»
µ¥Ñ¡×éradio£º $("input[@type=radio][@checked]").val();
ÏÂÀ¿òselect£º $('#sel').val();
¿ØÖÆ±íµ¥ÔªËØ£º
Îı¾¿ò£¬Îı¾ÇøÓò£º$("#txt").attr("value",'');//Çå¿ÕÄÚÈÝ
$("#txt").attr("value",'11');//Ìî³äÄÚÈÝ
¶àÑ¡¿òcheckbox£º $("#chk1").attr("checked",'');//²»´ò¹´
$("#chk2").attr("checked",true);//´ò¹´
if($("#chk1").attr('checked')==undefined) //ÅжÏÊÇ·ñÒѾ´ò¹´
µ¥Ñ¡×éradio£º $("input[@type=radio]").attr("checked",'2');//ÉèÖÃvalue=2µÄÏîĿΪµ±Ç°Ñ¡ÖÐÏî
ÏÂÀ¿òselect£º $("#sel").attr("value",'-sel3');//ÉèÖÃvalue=-sel3µÄÏîĿΪµ±Ç°Ñ¡ÖÐÏî
$("<option value='1'>1111</option><option value='2'>2222</option>").appendTo("#sel")//Ìí¼ÓÏÂÀ¿òµÄoption
$("#sel").empty()£»//Çå¿ÕÏÂÀ¿ò
ÍƼöÐÅÏ¢
- jqueryʵÏÖÍøվͼƬÀÁ¼ÓÔØ´úÂë
- jQuery Tooltips²å¼þ
- jQueryµÄ.bind()¡¢.live()ºÍ.delegate(....
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- Ä㲻ϲ»¶»ðºü£¬µ«ÓÖϲ»¶firebug£¬ÄǾ͸úÎÒÒ»ÆðÀ´ÔÚIEÉÏ....
- ¸ù¾ÝÏÔʾÆ÷·Ö±æÂʵ÷ÕûÒ³ÃæÏÔʾµÄJavascript½Å±¾
- jQuery дµÄ·ÂÐÂÀË΢²© ÏòϹö¶¯Ð§¹û¡¾×ªÔØ¡¿
- ͨÓõÄJqueryÑ¡ÔñÆ÷
- jQuery ½áºÏ Json Ìá½»Êý¾Ýµ½Webservice£¬....
- ×ÔÖÆjQueryÖÇÄÜÌáʾ²å¼þһö
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- js»ñÈ¡srcÖд«µÝµÄ²ÎÊý
- jqueryʵÏÖÍøվͼƬÀÁ¼ÓÔØ´úÂë
- ÈÃä¯ÀÀÆ÷ÆÁ±ÎµôJavaScriptµÄ³ö´íÌáʾ
- github²»ÄܼÓÔØcss¡¢js½â¾ö°ì·¨
- ÎÒÖªµÀµÄJavaScript -- Éè¼Æģʽ(ÇŽÓ)Ó¦ÓÃÖ® ¨C ....
- 15¸öÖµµÃ¿ª·¢ÈËÔ±¹Ø×¢µÄjQuery¿ª·¢¼¼ÇɺÍÐĵÃ
- dz̸JavascriptÃæÏò¶ÔÏó±à³Ì
- JS¼òµ¥¶¯»·â×°
- JavaScript³õѧÕßӦעÒâµÄÆ߸öϸ½Ú
- jQuery Tooltips²å¼þ
ÆÀÂÛ