Solved

jQuery-switchButton

Posted on 2014-09-17
8
960 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
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 our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Open dialog with server side controls in it 3 46
JavaScript Loan Calculator Error 3 34
Html date format 9 20
AngularJS: ng-repeat 25 24
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…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

749 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