Jump to:

3393 Posts in 976 Topics by 852 members

Template Questions

SilverStripe Forums » Template Questions » Back-End checkbox change to switch won't work the first load

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 327 Views
  • ud2013
    Avatar
    Community Member
    6 Posts

    Back-End checkbox change to switch won't work the first load Link to this post

    For a module (in de Back-End), I have changed the checkbox to a switch, this works but when I click a menu item in the left and click the add new item button, the checkbox is shown as checkbox but when I reload the page, the checkbox becomes a switch button.

    Here is the code I use (at the moment I have past it into the LeftandMain.ss of the admin/template:

    <script src="./themes/bootstrap/js/iphone-style-checkboxes.js"></script>
    <script type="text/javascript" charset="utf-8">
       (function($) {
          $(document).ready(function(){
             $('.on_off :checkbox').iphoneStyle();
          })
       })(jQuery);
    </script>

    Why does the checkbox change to the switchbutton when the page loads, but when reloading the page it does. I also used (window).load(function) instead of the document.ready function.

    Please any help.

    327 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.