jQuery¼¼Êõ

JQuery ÅжÏcheckboxÊÇ·ñÑ¡ÖУ¬checkboxÈ«Ñ¡£¬»ñÈ¡checkboxÑ¡ÖÐ

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2018-06-24 10:33 ÎÒÒªÆÀÂÛ( )

JQuery ÅжÏcheckboxÊÇ·ñÑ¡ÖУ¬checkboxÈ«Ñ¡£¬»ñÈ¡checkboxÑ¡ÖÐÖµ JQueryÊÇÒ»¸ö·Ç³£ÈÝÒ×ÉÏÊֵĿò¼Ü£¬µ«ÊÇÓкܶණÎ÷ÐèÒªÎÒÃÇÉîÈëѧϰµÄ¡£ ÅжÏcheckboxÊÇ·ñ±»Ñ¡ÖÐÍøÉÏÓÐÑ¡¶àÖÖд·¨£¬ÕâÀïÓÐÒ»ÖÖ·½·¨£¬¸öÈ˾õµÃ ±È½Ï·½±ã¡£ ÒòΪ±È½Ï¼òµ¥£¬Ã»Ê²Ã´¼¼Êõº¬Á¿£¬Ö±½Ó

JQuery ÅжÏcheckboxÊÇ·ñÑ¡ÖУ¬checkboxÈ«Ñ¡£¬»ñÈ¡checkboxÑ¡ÖÐÖµ

JQueryÊÇÒ»¸ö·Ç³£ÈÝÒ×ÉÏÊֵĿò¼Ü£¬µ«ÊÇÓкܶණÎ÷ÐèÒªÎÒÃÇÉîÈëѧϰµÄ¡£

ÅжÏcheckboxÊÇ·ñ±»Ñ¡ÖÐÍøÉÏÓÐÑ¡¶àÖÖд·¨£¬ÕâÀïÓÐÒ»ÖÖ·½·¨£¬¸öÈ˾õµÃ

±È½Ï·½±ã¡£

ÒòΪ±È½Ï¼òµ¥£¬Ã»Ê²Ã´¼¼Êõº¬Á¿£¬Ö±½Ó´úÂë

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>JQuery ÅжÏcheckboxÊÇ·ñÑ¡ÖУ¬checkboxÈ«Ñ¡£¬»ñÈ¡checkboxÑ¡ÖÐÖµ</title> <script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-1.6.4.min.js" ></script> <script type="text/javascript"> $(function(){ /*------------ È«Ñ¡/È«²»Ñ¡ ------------*/ $('#cboxchecked').click(function(){ //ÅжÏappleÊÇ·ñ±»Ñ¡ÖÐ var bischecked=$('#cboxchecked').is(':checked'); var fruit=$('input[name="fruit"]'); bischecked?fruit.attr('checked',true):fruit.attr('checked',false); }); /*------------- »ñÈ¡Ñ¡ÖÐÖµ -------------*/ $('#btn_submit').submit(function(){ $('input[name="fruit"]:checked').each(function(){ var sfruit=$(this).val(); alert(sfruit); }); return false; }); }) </script> </head> <body> <form action=""> <input type="checkbox" /> <label for="cboxchecked">È«Ñ¡/È«²»Ñ¡</label> <br /> <br /> <input type="checkbox" value="apple" /> <label for="apple">Apple</label> <input type="checkbox" value="orange" /> <label for="orange">Orange</label> <input type="checkbox" value="banana" /> <label for="banana">Banana</label> <input type="checkbox" value="grapes" /> <label for="grapes">Grapes</label> <br /> <br /> <input type="submit" value="submit" /> </form> </body> </html>

 

posted @

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
  • jQuery¶ÔÖ¸¶¨ÔªËØÖÐÖ¸¶¨×Ö·û´®½øÐÐÌæ»»µÄ·½·¨

    jQuery¶ÔÖ¸¶¨ÔªËØÖÐÖ¸¶¨×Ö·û´®½øÐÐÌæ»»µÄ·½·¨

    2018-07-05 13:46

  • jQuery .tmpl(), .template()§³

    jQuery .tmpl(), .template()§³

    2018-06-20 09:00

  • jquery»ñÈ¡¸´Ñ¡¿ò±»Ñ¡ÖеÄÖµ

    jquery»ñÈ¡¸´Ñ¡¿ò±»Ñ¡ÖеÄÖµ

    2018-06-13 09:02

  • jQuery treetable.js 3.2Ê÷ÐνṹĬÈÏÕ¹¿ªµÚÒ»²ã

    jQuery treetable.js 3.2Ê÷ÐνṹĬÈÏÕ¹¿ªµÚÒ»²ã

    2018-04-24 12:59

ÍøÓѵãÆÀ
£