¡@

Home 

2014/10/16 ¤W¤È 12:03:40

jquery Programming Glossary: hasmaintenance

How do you maintain the state of a checkbox-toggled div after page reload?

http://stackoverflow.com/questions/8406336/how-do-you-maintain-the-state-of-a-checkbox-toggled-div-after-page-reload

page reload the div is rendered based on the status of the checkbox Css #maintenance window display none jQuery #check hasMaintenance .click function this .is checked '#maintenance window' .show fast '#maintenance window' .hide fast HTML input type checkbox.. checked '#maintenance window' .show fast '#maintenance window' .hide fast HTML input type checkbox value 1 id check hasMaintenance div id maintenance window Stuff div javascript jquery share improve this question Option 1 Ensure div is shown based.. based on check box when the page loads document .ready function Modified for readability inline if is fine. if #check hasMaintenance .is checked '#maintenance window' .show fast else '#maintenance window' .hide fast Simplified hide show code #check hasMaintenance..