我在html中有以下代码:
<div class="uif-col-3">
<div id="id_SearchSuppliersByDocumentNumber">
<label class="control-label">@Global.EnterDocumentNumber:</label>
<input class="uif-autocomplete" type="text" data-source= @Url.Action("GetSuppliersByDocumentNumber", "Common")
data-displaykey="DocumentNumber" onkeypress=" return JustNumbers(event, this); " maxlength="20"
placeholder='@Global.EnterDocumentNumber' id="SearchSuppliersByDocumentNumber"
name="SearchSuppliersByDocumentNumber" hidden="hidden" />
</div>
<div id="id_SearchAgentByDocumentNumber">
<label class="control-label">@Global.EnterDocumentNumber:</label>
<input class="uif-autocomplete" type="text" data-source="@Url.Action("GetAgentByDocumentNumber", "Common")"
data-displaykey="DocumentNumber" onkeypress=" return JustNumbers(event, this); " maxlength="20"
placeholder='@Global.EnterDocumentNumber' id="SearchAgentByDocumentNumber"
name="SearchAgentByDocumentNumber" hidden="hidden" />
</div>
</div>
<div class="uif-col-3">
<div id="id_SearchSuppliersByName">
<label class="control-label">@Global.EnterName:</label>
<input class="uif-autocomplete" type="text" data-source="@Url.Action("GetSuppliersByName", "Common")"
data-displaykey="Name" placeholder='@Global.EnterName' id="SearchSuppliersByName" maxlength="60"
name="SearchSuppliersByName" hidden="hidden" />
</div>
<div id="id_SearchAgentByName">
<label class="control-label">@Global.EnterName:</label>
<input class="uif-autocomplete" type="text" data-source="@Url.Action("GetAgentByName", "Common")"
data-displaykey="Name" placeholder='@Global.EnterName' id="SearchAgentByName" maxlength="60"
name="SearchAgentByName" hidden="hidden" />
</div>
</div>
和Javascript:
我能够显示文字:
$("#id_SearchSuppliersByName").css("display", "block");
$("#id_SearchSuppliersByDocumentNumber").css("display", "block");
但我无法显示输入标记:
$("#id_SearchSuppliersByName").val("");
$("#id_SearchSuppliersByDocumentNumber").val("");
有什么想法吗?我也尝试使用show()但不起作用
答案 0 :(得分:2)
从输入中删除hidden="hidden"
属性。如果您希望使用div的ID控制可见性,请隐藏div。