<tr><td id="t1">1111</td></tr>
 用jquery 这样写  $("#t1").html("22")
为什么不行啊 ? 求正解!!!

解决方案 »

  1.   

    <!--没有问题-->
    <table>
        <tr><td id="t1">1111</td></tr>
    </table>
        <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                $("#t1").html("2222");
            })
        </script>
      

  2.   

    感谢各位,其实是我自己犯了个错,我实际在项目中是这样取的
    $("td[id='t1']").html("22")
    这样改行不通,
      

  3.   

    你这样写也可以的!因为id是td的属性,测试了下完全可以!检测下其他地方是不是有写错
    <!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>
        <title>无标题页</title>
        <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
        <script>
    $(document).ready(function(){
       $("#t1").append("222")
       $("td[id='t1']").append("333")
    })
        </script>
    </head>
    <body>    
    <table>
    <tr>
    <td id="t1">1111</td>
    </tr>
    </table>
    </body></html>
      

  4.   

       <td id="t1"> </td>        </tr> 
     <script type="text/javascript">        
    $(function () {$("#t1").html(""); });    
    </script>