-->

Kendo Ui Dropdownlist Set Visible via Javascript

2020-08-17 05:06发布

问题:

I need to set kendo dropdownlist visible programmatically in javaScript.

I had tried:

dropdownlist=$("#ddl").data("kendoDropDownList");
dropdownlist.visible(false);
dropdownlist.isVisible(true);
dropdownlist.visible("false");
dropdownlist.isVisible("true");

etc...

回答1:

One should always use the API docs to see the features of a widget. In this case, there is no API method for hiding a widget, but you can hide its wrapper element:

var dropdownlist = $("#ddl").data("kendoDropDownList");
dropdownlist.wrapper.hide(); // call wrapper.show() to make it visible again


回答2:

Try like this,

$("#ddl").closest(".k-widget").hide();
 $("#ddl").closest(".k-widget").show();