在一个div里面有很多checkbox控件,怎么将其中选中的checkbox转到另一个div中呢?jquerycheckboxjavascript

解决方案 »

  1.   


    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>text</title>
    </head>
    <body>
        <div id="div1">
        <input type="checkbox" value="0"/>
          <input type="checkbox" value="2"/>
            <input type="checkbox" value="3"/>
              <input type="checkbox" value="4"/>
                <input type="checkbox" value="5"/>
                  <input type="checkbox" value="6"/>
        </div>
        <br />
        <input type="button" onclick="changeDiv();" value="ok"/>
        <br />
           <div id="div2">
        
        </div>
    </body>
    </html>
    <script type="text/javascript" src="/jquery/jquery-1.7.1.min.js"></script><!--改成 自己的jquery-->
    <script type="text/javascript">
        function changeDiv(){
           var $box= $("#div1 input:checked");
           $("#div2").append($box);
        }
    </script>