Skip to content
Advertisement

How to disable the range slider when the checkbox is checked in jquery?

I want my range slider is disabled when the checkbox is checked using jquery.If check box is unchecked then range slider want to be enable.My code is,

$(document).on('change','#checkbox6b',function()
{
    if("input[name='responsive']:checked")
    {
      /* code */
    }
    else
    {
      /* code */
    }
});

Can anyone help me?

Advertisement

Answer

Just call properties disable and enable on your range slider.

Please replace the id with your ranger’s HTML ID attribute.

$(document).on('change','#checkbox6b',function()
{
    if($("input[name='responsive']:checked"))
    {
      $('#YOUR-SLIDER-ID').slider('disable');
    }
    else
    {
      $('#YOUR-SLIDER-ID').slider('enable');
    }
});
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement