简体   繁体   中英

How to turn toggle button off automatically

I want to be toggle button automatically off and whatever I will select that product should be off. And when click on then it should be show that product.

HTML

<div class="heading" id="seamless" style="display: none;">
   <center>PayPal now accepted! Make a sale and we'll email you to claim your funds. Easy!Your email: admin@example.com</center>
</div>

Toggle Button

<div id="normal-toggle-button">
   <input name="open" value="1" type="checkbox" onchange="checkshowhidereverse(this.status, '#seamless');checkshowhidereverse(this.status, '#setup');" checked="checked" />
</div>

Javascript

$(document).ready(function () {
   //* toggle buttons
   toggle_buttons.init();
});

Javascript function

//* toggle buttons
toggle_buttons = {
    init: function () {
        $('#normal-toggle-button').toggleButtons();
    }
};

I am not quite sure if i understood it well?

Initially DIV is hidden, checkbox unechecked ? if yes how about this

http://jsfiddle.net/8sCw8/

<div class="heading" id="seamless" style="display: none;">
<center>PayPal now accepted! Make a sale and we'll email you to claim your funds. Easy!Your email: admin@example.com</center>
</div>

<div id="normal-toggle-button">
<input id="checkBox" name="open" value="1" type="checkbox"/>
</div>

JS:

$('#checkBox').click(function() {
 if( $(this).is(':checked')) {
     $("#seamless").show();
 } else {
     $("#seamless").hide();
 }
}); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM