如 <div id="aaa">123</div>  这样的DIV  我想在jquery 里面获取到123  ,求教怎么做。?

解决方案 »

  1.   

    有个新问题。 现在获得这个123了。 我就是里面 我想给这个123 做+1 操作。然后div标签里面显示变成124.怎么做? - -
      

  2.   

    有个新问题。 现在获得这个123了。 我在js里面 我想给这个123 做+1 操作。然后div标签里面显示变成124.怎么做? - -
      

  3.   

    $('#aaa').html(parseInt($('#aaa').html())+1)
      

  4.   

    页面没能 变成124 ,我吧你给的 东西alert出来 是[object Object];
      

  5.   

    我吧核心代码发一下吧<script language="javascript">
         function  fun_vote(){
     $('#aaa').html(parseInt($('#aaa').html())+1)

      }</script><div id="aaa"> 123 </div>
    <input type="button" onclick="fun_vote()" value="投票"/>
      

  6.   

    $("#aaa").html(parseInt($("#aaa").html()) + 1); //这样写肯定没问题没有变成124说明你写的代码有问题,整理一下发上来看看。
      

  7.   


    没问题的,估计是别的代码有问题,错误控制台下看看浏览器报什么错误。
    <!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>无标题文档</title>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"></script>
    <script type="text/javascript">
    function fun_vote() {
        $('#aaa').html(parseInt($('#aaa').html()) + 1);
    }
    </script>
    </head><body>
    <div id="aaa"> 123 </div>
    <input type="button" onclick="fun_vote()" value="投票" />
    </body>
    </html>