javascript - Change the value of input while toggle
女神的闺蜜爱上我
女神的闺蜜爱上我 2017-06-12 09:32:25
0
2
793

I now have a button that displays hidden content when clicked. This can be achieved with toggle, but how can I not separately determine whether the content is hidden, but directly replace the value in the button while displaying the hidden content in toggle? Between " " and " -" to switch between.

<input type="button" value="-" class="hsBtn">
$(".hsBtn").live("click",function(){
    $(target).toggle();
})
女神的闺蜜爱上我
女神的闺蜜爱上我

reply all(2)
女神的闺蜜爱上我
<input type="button" value="-" class="hsBtn">
$(".hsBtn").live("click",function(){
    var $this=$(this),
        val=$this.val();
    $this.val(val=='-'?'+':'-')
    $(target).toggle();
})
洪涛

Then determine whether the content to be displayed is in the display state. If so, it is -, otherwise it is +

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template