Jquery增量BY 1不起作用 [英] Jquery increment BY 1 is not working

查看:82
本文介绍了Jquery增量BY 1不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<head>
<script type="text/javascript" src="scripts/jquery.js"></script>
 <script type="text/javascript">
$(document).ready(function(){
    $('a.like').click(function () {
        $.post("like.cfm", {postid:$(this).attr("postid"),uid:$(this).attr("uid")} );
        $(this).hide();
        $(".unlike").show();
        $(".hw").html($(".hw") + 1);

    });
    $('a.unlike').click(function () {
        $.post("unlike.cfm", {pageID:$(this).attr("postid")} );
        $(this).hide();
        $(".like").show();
        $(".hw").html('-1');
        $(".hw").html($(".hw") - 1);
    });
});
</script>
</head>
<body>
<a href="##" class="like" postid="1234" uid="131">Like</a>
<a href="##" class="unlike" style="display:none;" postid="1234">Unlike</a>
<span class="hw">100</span>
</body>







点击链接我要在hw中添加+1价值!但我正在使用的代码不起作用:(




Clicking on like link i want to add +1 in "hw" value ! But the code i'm using is not working :(

推荐答案

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


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


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


这篇关于Jquery增量BY 1不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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