I am using the: http://api.jqueryui.com/spinner how can I set it so that if the input has attr=disabled it will disable the spinner?
<input type="checkbox" />
<input type="text" class="spinner" />
if($checkbox.attr("checked")){
$input.removeAttr('disabled').spinner();
} else {
$input.attr('disabled', true).spinner("option", "disabled", true);
}
This code give me error: cannot call methods on spinner prior to initialization; attempted to call method 'option'
Try this: http://jsbin.com/ojiwas/1/edit
$( ".spinner" ).prop('disabled',true);
$(':checkbox').change(function(){
if($(':checked').length>0){
$( ".spinner" ).spinner();
}else{
$( ".spinner" ).spinner("destroy").prop('disabled',true);
}
});