Solved

jQuery-switchButton

Posted on 2014-09-17
8
743 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
Comment Utility
0
 
LVL 2

Author Comment

by:Elxn
Comment Utility
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
Comment Utility
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
Comment Utility
<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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 2

Author Comment

by:Elxn
Comment Utility
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
Comment Utility
put jquery ui plugin before the switch one
0
 
LVL 2

Author Comment

by:Elxn
Comment Utility
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
Comment Utility
Great advice.  It took experience to solve this problem!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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)
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…

744 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

12 Experts available now in Live!

Get 1:1 Help Now