Remove Datepicker Function dynamically

后端 未结 6 1532
时光取名叫无心
时光取名叫无心 2020-12-03 02:31

I want to remove datepicker function depending on the dropdownlist selected value. I try the following codes, but it still shows the calendar when I put the cursor in the t

6条回答
  •  执笔经年
    2020-12-03 02:56

    Just bind the datepicker to a class rather than binding it to the id . Remove the class when you want to revoke the datepicker...

    $("#ddlSearchType").change(function () { 
      if ($(this).val() == "Required Date" || $(this).val() == "Submitted Date")                   { 
        $("#txtSearch").addClass("mydate");
        $(".mydate").datepicker()
      } else { 
        $("#txtSearch").removeClass("mydate");
      } 
    }); 
    

提交回复
热议问题