Solved

jQuery-switchButton

Posted on 2014-09-17
8
903 Views
Last Modified: 2014-09-18
I am using this script: code.

I am trying to get the switch button to show up like the example (view examples here), but for some reason it isn't working and I don't know why.

jQuery I'm using:
$("input#switch").switchButton({
   labels_placement: "right"
});

Open in new window


HTML I'm Using:
<div class="switchButton">
	<input id="switch" type="checkbox" name="anonymous" value="1" checked>
</div>

Open in new window


The URL It's supposed to work on:  http://girlzunderground.com/rate-pics.php  (the code in question is ajaxed to the page, but you can see it with Chrome's "inspect element" feature.)

The checkbox on this page is in the upper left hand corner of the box with the stars in it.  Right now it's just a plain checkbox and I would like to have it be the switch button like on the example I provided.

Thanks for the help!
0
Comment
Question by:Elxn
  • 4
  • 4
8 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40329241
0
 
LVL 2

Author Comment

by:Elxn
ID: 40330479
Thanks for the comment.  I tried it out and added jQuery UI 1.11.1.  I also changed the binding function to be like yours.  But it still doesn't work.  I have no idea why!  Any other thoughts?

Thanks!
0
 
LVL 82

Expert Comment

by:leakim971
ID: 40330511
check source of this working page : http://fiddle.jshell.net/5ec1gvqs/4/show/
teher's no more
provide a link to your page
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 82

Expert Comment

by:leakim971
ID: 40330512
<link rel="stylesheet" type="text/css" href="/css/result-light.css">

is not part of the plugin but from jsfiddle, you don't need it
0
 
LVL 2

Author Comment

by:Elxn
ID: 40330550
http://girlzunderground.com/rate-pics.php

That is where I'm trying to use it.  My original post has a little more detail.

Yeah I seem to have got everything as you can see in the head of my doc.  Its strange how this isn't working.
0
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 500 total points
ID: 40330555
put jquery ui plugin before the switch one
0
 
LVL 2

Author Comment

by:Elxn
ID: 40330561
Ha!  That putting jquery ui before the switch js worked!  crazy...  I bet I woulda been absolutely lost with that being the problem.  I guess it takes experience to know this and now I know this trick.  Thanks man!
0
 
LVL 2

Author Closing Comment

by:Elxn
ID: 40330563
Great advice.  It took experience to solve this problem!
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Head to not include on scroll 4 23
Find closest specified item from present item - Javascript 5 33
Html value of radio 14 28
I'm a Human captcha checkbox 13 19
Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question