$(コンポーネント指定).checkboxradio('enable');
$(コンポーネント指定).checkboxradio('disable');
$(コンポーネント指定).checkboxradio("refresh");
※リストが表示されない場合
AddBlockなどの広告ブロックツールがONになっているとリストなどが表示されない場合があります。これらのツールをOFFにしてみてください。
<!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" xml:lang="ja"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <title>Sample</title> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script> <script type="text/javascript" src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script> <script type="text/javascript"> $('#home').live('pagecreate',function(){ $('#check1').bind('change',doAction); $('#check2').attr("checked",true); }); function doAction(){ var val = $('#check1').attr('checked'); if (val){ $('#check2').checkboxradio('enable'); $('#check2').attr("checked",true); $('#check2').checkboxradio("refresh"); } else { $('#check2').checkboxradio('disable'); $('#check2').attr("checked",false); $('#check2').checkboxradio("refresh"); } } </script> </head> <body> <!-- home page --> <div id="home" data-role="page"> <div data-role="header"> <h1>Hello</h1> </div> <div data-role="content"> <p>※サンプル。</p> <div data-role="fieldcontain"> <input type="checkbox" name="check1" id="check1" /> <label for="check1">check box</label> </div> <div data-role="fieldcontain"> <input type="checkbox" name="check2" id="check2" /> <label for="check2">check box</label> </div> </div> </div> </body> </html>
次へ >> |