jqueryjquery-mobiledatebox

jQuery mobile datebox 'disable' not working


I'm using an inline datebox in a side panel. Under some circumstances, I want to disable the control programatically. Following the API instructions, I did this (coffeescript):

$("#dateInput").datebox 'close'

but the control is still enabled and this returns 'false':

alert $("#dateInput").datebox 'getOption', 'disabled'

Suspecting that there was a mistake in the API doc, I looked at the datebox source and saw that there actually is a "disable" function, so I tried this:

$("#dateInput").datebox 'disable'

But again, no luck. Any suggestions?


Solution

  • Try:

    // disable
    $("#dataInput").parent("div").addClass("ui-disabled");
    
    // enable
    $("#dataInput").parent("div").removeClass("ui-disabled");
    
    // toggle enable/disable
    $("#dataInput").parent("div").toggleClass("ui-disabled");
    

    JSFiddle