日期:2014-05-16  浏览次数:20294 次

jQuery问题,请问如何用jQuery清除<table>表单中的所有行。
网上的下列方法都试过了,还是不行。请大虾指点
$('table tbody').empty();
$("table tbody").html("");

------解决方案--------------------
HTML code

<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="gb2312" />
        <title></title>        
        <style>
        </style>        
        <script src="http://code.jquery.com/jquery-latest.js"></script>
    </head>
    <body>
        <table>
            <tbody>
                <tr>
                    <td>123</td>
                </tr>
            </tbody>
        </table>
        <script>
            $('table tbody').empty();
        </script>
    </body>
</html>

------解决方案--------------------
$(table tr).empty();试过没?