jquery  的 hover事件是这样的
hover(function(){}, function(){});
楼主是不是只有一个事件所以不行?或者addClass大小写的问题?

解决方案 »

  1.   

    addClass() 只有一个function也会触发
      

  2.   

    亲测有效
    <html>
    <head>
    <script type="text/javascript" src="/jquery/jquery.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
      $("button").click(function(){
        $("p:first").removeClass("intro").addClass('main');
      });
    });
    </script>
    <style type="text/css">
    .intro
    {
    font-size:120%;
    color:red;
    }
    .main
    {
    font-size:90%;
    color:blue;
    }
    </style>
    </head><body>
    <h1>This is a heading</h1>
    <p class="intro">This is a paragraph.</p>
    <p>This is another paragraph.</p>
    <button>改变第一个段落的类</button>
    </body>
    </html>