Bttstrp / bootstrap-switch

Turn checkboxes and radio buttons in toggle switches.
MIT License
5.09k stars 1.45k forks source link

the example can't run #530

Open tianxuzhang opened 8 years ago

tianxuzhang commented 8 years ago

the example in https://github.com/nostalgiaz/bootstrap-switch/ can't run

<html>
    <head>
        <link href="bootstrap.min.css" rel="stylesheet">
        <link href="bootstrap-switch.css" rel="stylesheet">
        <script src="jquery.min.js"></script>
        <script src="bootstrap-switch.js"></script>
    </head>
    <body>
        <script>
            $("[name='my-checkbox']").bootstrapSwitch();
        </script>
        <input type="checkbox" name="my-checkbox" checked>
    </body>
</html>

could you help me?

tianxuzhang commented 8 years ago

i find the reason. this example depends on highlight and main. but why don't you mention it!!!

digital216 commented 8 years ago

I'm not certain what you mean by highlight and main, but I think you're problem is that you call the script first, then drop in the input. The input doesn't exist at the time the script is parsed so nothing happens. Switch the input and script, putting the input before the script and everything should work.

HillChris7714 commented 8 years ago

I actually can't get it to run either, and I have the script under the checkbox. I think it has to do with me not knowing exactly where everything is supposed to go. I downloaded the files, put the folder in with my web page, and nothing. I just get a regular check box... no switch.