jQuery: enabling/disabling datepicker

前端 未结 18 1054
青春惊慌失措
青春惊慌失措 2020-12-03 06:38

In my php-file, I want to use the jQuery Datepicker.

When my file loads, I create the Datepicker disabled.

Then, when a special field in my php-file (it is a

18条回答
  •  不思量自难忘°
    2020-12-03 07:18

    Datepicker is disabled automatically when the input text field is made disabled or readOnly:

    $j("#" + CSS.escape("${status.expression}")).datepicker({
        showOn: "both",
        buttonImageOnly: true,
        buttonImage: "",
        dateFormat: "yymmdd",
        beforeShow: function(o, o2) {
        var ret = $j("#" + CSS.escape("${status.expression}")).prop("disabled")
            || $j("#" + CSS.escape("${status.expression}")).prop("readOnly");
    
        if (ret){
            return false;
        }
    
        return o2;
    }
    });
    

提交回复
热议问题