我有一个html页面。
html页面的主体中有一个div,我在其中添加了一些按钮和图像。
<div id="div_one">
<button id="button_one">
<asp:Image id="image_button_one" ImageUrl=".." runat="server">
</button>
</div>
在这个div上,有一个表格我放在里面:
<form..>
<asp:ImageButton id="id_one" runtat="server" ImageUrl=".." visible="false">.
</form>
这些按钮具有关联的jquery / javascript。
例如,当我单击按钮“ button_one”时,有一些CSS会修改页面,而没有别的。
关键是:当执行jquery($(“#button_one”)。click(){..})时,我想可视化ImageButton,如果最终单击,则更改页面。
是否可以引用该ImageButton使其可视化并在必要时使用它?
最佳答案
首先将其ClientIDMode设为static:
<form..>
<asp:ImageButton id="id_one" runtat="server" ClientIDMode="Static" ImageUrl=".." visible="false">.
</form>
JQUERY:
$("#id_one").click(function(){
// do something here
})
为了使其可视化:
$("#id_one").show();
更新:
在Visible =“ false”的情况下,不会在客户端上呈现控件,因此无法通过客户端脚本对其进行访问,而不是通过设置visible来设置css属性,例如:
<asp:ImageButton id="id_one" style="display:none;" runtat="server" ImageUrl=".."
visible =“ true”>