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('▶');
} else {
$this.html('▼');
}
关于javascript - 未嵌入帖子中的禁用按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33116229/