jQuery UI Widgets Forums Editors Button, RepeatButton, ToggleButton, LinkButton change color when switch button is clicked

This topic contains 1 reply, has 2 voices, and was last updated by  Stanislav 2 years, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • change color when switch button is clicked #96034

    wpd
    Participant

    I am using switch button in my code .
    I am trying to implement color change when user clicked on the switch button
    my code
    $(‘#recentButton’).jqxSwitchButton({ height: 27, width: 81, checked: true });

    is there any way to make green color when user click on the switch button and remove it when user off the switch

    change color when switch button is clicked #96040

    Stanislav
    Participant

    Hello wpd,

    Take a look at this example:

    $(document).ready(function () {
    
        $('#recentButton').jqxSwitchButton({ height: 27, width: 81, checked: true });
    
        $('.jqx-switchbutton').on('checked', function () {
            $('body').css('background-color' , 'blue');
        });
    
        $('.jqx-switchbutton').on('unchecked', function () {
            $('body').css('background-color' , 'white');
        });
    });

    It should do the job.

    Best Regards,
    Stanislav

    jQWidgets Team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.