jQuery UI Widgets › Forums › General Discussions › Editors › Button, RepeatButton, ToggleButton, LinkButton › How can i post jqxSwitchButtons state?
Tagged: Button, jqxSwitchButton, switchButton
This topic contains 1 reply, has 2 voices, and was last updated by Nadezhda 11 years ago.
-
Author
-
Hi!
It is possible that the jqxSwitchButton is not part of the form? Because its state is not in the post variable.
How can i post jqxSwitchButtons state?Hello TomiG.,
In the following example you will find only one jqxSwitchButton without the form from Switch Button demo. You can post the button state with ‘checked’ and ‘unchecked’ events, how it is shown below:
<!DOCTYPE html> <html lang="en"> <head> <title></title> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxswitchbutton.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcheckbox.js"></script> <script type="text/javascript" src="../../scripts/demos.js"></script> <script type="text/javascript"> $(document).ready(function () { $('#button1').jqxSwitchButton({ height: 27, width: 81, checked: true }); $('.jqx-switchbutton').on('checked', function (event) { $('#events').text('Checked'); }); $('.jqx-switchbutton').on('unchecked', function (event) { $('#events').text('Unchecked'); }); }); </script> <style type="text/css"> .settings-setter { float: left; margin-right: 14px; margin-top: 8px; } .events-container { margin-left: 20px; } </style> </head> <body> <div class="settings-setter"> <div id="button1"></div> </div> <div class="events-container"> <div>Events:</div> <div id="events"></div> </div> </body> </html>Best Regards,
NadezhdajQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.