Comments (5)
Error fires on page load when placed inside a call to document.ready and error fires on button click when not placed inside call to document.ready. Call to switchButton is as follows:
$("#count").switchButton({
on_label: 'count',
off_label: '%',
labels_placement: 'left',
width: 50,
height: 20,
button_width: 20
});
from jquery-switchbutton.
I do not know the cause of this issue but I have managed to get it to work using the following method inside a call to document.ready:
$(function() {
$( "#count_percent" ).append( "<input type="checkbox" value="true" id="count" checked>" );
$("#count").switchButton({
on_label: 'count',
off_label: '%',
labels_placement: 'left',
width: 50,
height: 20,
button_width: 20
});
});
My best guess is that this has something to do with the fact that the code is generated server side using jsp includes tags and is rendered by the spring framework.
from jquery-switchbutton.
Hi,
thanks for your report!
Is there anywhere in your code where you would call $("#count").switchButton("option", "xxxxx", yyy)
?
The error message you pasted in your first message suggests that you're trying to get the value of a switchbutton option, or change it, before it has actually been initialized.
This is a jQuery UI error. You probably have code somewhere that is executed before the button is actually initialized.
from jquery-switchbutton.
Hi, I dont specifically make a call to that myself. I just copied the examples from your demo page. I tried them on my main page which has a lot of javascript and html and is serverside generated and got the issue.
When I moved just this bit out to a standard html file I no longer got the issue so I figured it had to be to do with the order of loading of elements or scripts. Firebug showed everything loaded and there were no other issues but I imagine this would be pretty difficult to replicate.
I found a workaround which I posted above which works as I guess it puts the element into the dom and then fires a call to your function to set the slider. This seems to work and the slider performs as I would expect in both IE and firefox (which is all we support for our userbase) so I am more than happy!
Thanks!
from jquery-switchbutton.
Okay, so this is indeed more likely to be a problem linked to how your page is rendered rather than a problem of the plugin itself ^^
I'm glad to see someone's using it though :)
from jquery-switchbutton.
Related Issues (14)
- Underlying checkbox "checked" attribute does not change even though redraw occurs HOT 4
- Error in Jquery ui 1.10.3 HOT 2
- Not working with jquery / ui (latest)
- e
- Changing the underlaying input type="checkbox" don't refresh the state of the switch HOT 2
- Not possible to disable the button? HOT 5
- working in chrome but not in ie 11 HOT 2
- Callback? HOT 3
- help
- Toggle events
- What are the jquery and jqueryui requirements? HOT 2
- Enable button css font-resize from jquery
- Triggering a Refresh HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-switchbutton.