Jquery脚本无法正常工作 [英] Jquery script is not working

查看:80
本文介绍了Jquery脚本无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<head>
<script type="text/javascript" src="scripts/jquery.js"></script>
 <script type="text/javascript">
$(document).ready(function(){
    $('a.like').click(function () {
        $.post("like.cfm", {pageID:$(this).attr("postid")} );
        $(this).removeClass('like').addClass('unlike').html('Unlike');
    });
    $('a.unlike').click(function () {
        $.post("unlike.cfm", {pageID:$(this).attr("postid")} );
         $(this).removeClass('unlike').addClass('like').html('Like');
    });
});
</script>
</head>
<body>
<a href="##" class="like" postid="1234">Like</a>
</body>







当我点击喜欢链接然后它运行良好并将类更改为不同但当我点击不像时没有任何反应!




When i click on "like" link then it's work well and change the class to unlike but when i click on "unlike" nothing happens !

推荐答案

(document).ready(function(){
(document).ready(function(){


('a.like')。click(function(){
('a.like').click(function () {


.post(like.cfm,{pageID:
.post("like.cfm", {pageID:


这篇关于Jquery脚本无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆