This topic contains 4 replies, has 2 voices, and was last updated by  Hristo 10 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • How to get SwitchButton value? #113811

    my_2000
    Participant
    <script type="text/javascript">
        $(document).ready(function () {
    	  $('.SwitchButton').jqxSwitchButton({ height: 30, width: 70});
    	  $('.SwitchButton').on('change', function (event) {
                 alert(event.my_value);
              });
        })
    </script>
    <div id="button1" class="SwitchButton" my_value="1"></div><br>
    <div id="button1" class="SwitchButton" my_value="2"></div><br>
    <div id="button1" class="SwitchButton" my_value="3"></div><br>

    How to get “my_value”!

    How to get SwitchButton value? #114026

    Hristo
    Participant

    Hello my_2000,

    Please, take a look at this example:
    http://jsfiddle.net/0pe4fkuh/

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

    How to get SwitchButton value? #114029

    my_2000
    Participant

    China can’t browse this website´╝ühttp://jsfiddle.net/

    How to get SwitchButton value? #114045

    my_2000
    Participant

    Please paste the code here. Thank you

    How to get SwitchButton value? #114048

    Hristo
    Participant

    Hello my_2000,

    Thank you for these details.
    Please, take a look at these code snippets:
    HTML:

    <div id="jqxSwitchButton"></div>
    <br>
    <div id="button1" class="SwitchButton" my_value="1"></div><br>
    <div id="button2" class="SwitchButton" my_value="2"></div><br>
    <div id="button3" class="SwitchButton" my_value="3"></div><br>

    JavaScript:

    $("#jqxSwitchButton").jqxSwitchButton({
      height: 35,
      width: 80,
      theme: "energyblue"
    });
    
    $("#jqxSwitchButton").bind("change", function (event) {
      console.log(event); 
    });
    
    $(".SwitchButton").jqxSwitchButton({ height: 30, width: 70});
    $(".SwitchButton").on("change", function (event) {
      var target = event.target;  
      var result = target.getAttribute("my_value");
      console.log(result);
    });
    

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.