admin管理员组文章数量:1328017
In the below code I have a div I have set to false and I want to make visible true using jQuery. If I remove visible false in div I can make visible. Please help me to do this.
<div id="divmaterialconsumption" runat="server" visible="false" ></div>
JavaScript:
$('#<%=divmaterialconsumption.ClientID %>').show();
In the below code I have a div I have set to false and I want to make visible true using jQuery. If I remove visible false in div I can make visible. Please help me to do this.
<div id="divmaterialconsumption" runat="server" visible="false" ></div>
JavaScript:
$('#<%=divmaterialconsumption.ClientID %>').show();
Share
Improve this question
edited Oct 12, 2017 at 12:31
Shiladitya
12.2k17 gold badges28 silver badges42 bronze badges
asked Apr 17, 2015 at 8:59
MosesMoses
692 silver badges9 bronze badges
3
- 1 did you try to add this js in $(document).ready(function () { ... your code ..} – Aleksandar Gajic Commented Apr 17, 2015 at 9:02
- @Alex G My problem is If i set visible false div in design it is not working if i remove false in design i can make to visible/invisible – Moses Commented Apr 17, 2015 at 9:03
- 1 oh, than instead of visible="false" set style="display: none;" – Aleksandar Gajic Commented Apr 17, 2015 at 9:04
2 Answers
Reset to default 4visible="false"
on a server control (e.g. runat="server"
) stops it being rendered at all!
Instead hide it with style="display:none"
and get rid of the visible="false"
jQuery's show() method can then change the style to display: block
Do the program as follows:
<div id="divmaterialconsumption" style="display:none;" ></div>
jQuery:
$(document).ready(function(){
$('#but1').click(function(){ //assuming event taking by click of a btn
$('#divmaterialconsumption').css('display','block');
});
});
OR
$('#divmaterialconsumption').show();
I hope that solves your issue!
本文标签: javascriptTo make div visible using jQueryStack Overflow
版权声明:本文标题:javascript - To make div visible using jQuery - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742240168a2438780.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论