post 中未嵌入的禁用按钮
Disabled button which is not embedded in the post
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('▼');
}
是这样的吗?
https://jsfiddle.net/svq5scnm/
$('.SeeMore2').click(function(){
var $this = $(this);
$this.toggleClass('SeeMore2');
$this.toggleClass('SeeLess2');
});
.SeeMore2 .less{
display:none;
}
.SeeLess2 .more{
display:none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button class="SeeMore2"><span class="more">See More <span class="arrowdown">►</span></span><span class="less">See Less <span class="arrowup">▲</span></span></button>
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('▼');
}
是这样的吗? https://jsfiddle.net/svq5scnm/
$('.SeeMore2').click(function(){
var $this = $(this);
$this.toggleClass('SeeMore2');
$this.toggleClass('SeeLess2');
});
.SeeMore2 .less{
display:none;
}
.SeeLess2 .more{
display:none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button class="SeeMore2"><span class="more">See More <span class="arrowdown">►</span></span><span class="less">See Less <span class="arrowup">▲</span></span></button>