Solved

jQuery-switchButton

Posted on 2014-09-17
8
803 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
 
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now