javascript - 未嵌入帖子中的禁用按钮

标签 javascript jquery button onclick

This is an editted question. Apologised for not stating it clearly.

我有一个新闻页面,其中将显示产品列表和一个按钮,用户可以单击该按钮查看可用的优惠券。我不确定如何完成它。

 <button id="coupon_id" type="submit" value="Coupon" class="buttonlink"
                                onclick="parent.location='<?php echo 'receipt-singleview?id=' . $eachData["couponId"]; ?>'">Coupon</button>

我试图编写这个代码,但它已经完成了一半,因为我只是对其进行了测试。

<script>
        if(!$('input').val()){
    $('#coupon_id').hide();
}
else {
    $('#coupon_id').show();
}
</script>

最佳答案

看起来你可以使用 $().html 方法来设置你想要的箭头。

fiddle :https://jsfiddle.net/x8oebpqf/

    if($this.hasClass('SeeMore2')){
        $this.html('&#9654');           
    } else {
        $this.html('&#9660');
    }

关于javascript - 未嵌入帖子中的禁用按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33116229/

相关文章:

javascript - 为什么 jQuery 不允许我为 div 的背景颜色设置动画?

选择器中的 jQuery 通配符

javascript - Jquery 动画 : how to make text appear when a element has changed color or styles

Python Gtk3 控制按钮大小

java - GWT按钮(图片+文字)

html - HTML 中的多行按钮

javascript - jQuery :input selector not selecting :select elements?

javascript - 离线网站如何保存数据?

javascript - Google map + Google 本地搜索根据英国邮政编码生成纬度/经度

javascript - Jquery fileupload 没有给我正确的路径