admin管理员组文章数量:1399466
I am trying to display when button is click then another button will be display for this I try this but not working
<div class="rightdiv">
<div id="BTNONE">
<asp:Button ID="Button2" runat="server" Text="New Tab" OnClick="Button2_Click" style="display: none;" />
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /><br />
</div>
</div>
<script type="text/javascript">
$(function () {
$("#Button1").on('click', function () {
$("#BTNONE").show();
});
});
</script>
I am trying to display when button is click then another button will be display for this I try this but not working
<div class="rightdiv">
<div id="BTNONE">
<asp:Button ID="Button2" runat="server" Text="New Tab" OnClick="Button2_Click" style="display: none;" />
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /><br />
</div>
</div>
<script type="text/javascript">
$(function () {
$("#Button1").on('click', function () {
$("#BTNONE").show();
});
});
</script>
Share
Improve this question
edited Aug 15, 2016 at 7:29
Rory McCrossan
338k41 gold badges320 silver badges351 bronze badges
asked Aug 15, 2016 at 7:25
user6628729user6628729
3232 gold badges7 silver badges26 bronze badges
4 Answers
Reset to default 2i think your code is work. but i try using html.
$(function () {
$("#Button1").on('click', function () {
$("#Button2").show();
});
});
<script src="https://ajax.googleapis./ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="rightdiv">
<div id="BTNONE">
<button type="button" ID="Button2" value="New Tab" style="display: none;" />
Button 2
</button>
<button ID="Button1" value="Button" />Button 1</button>
</div>
</div>
The #BTNONE
div is not hidden - it's the first <button />
within it so, your
selector is incorrect.
Also note that when using the runat="server"
attribute on an ASP.Net control means that you cannot necessarily rely on the ID
attribute being the same when the control is rendered on the client.
With that in mind, try this:
$("#BTNONE button:eq(1)").on('click', function () {
$("#BTNONE button:eq(0)").show();
});
your hidden button id isbutton2
<script type="text/javascript">
$(function () {
$("#Button1").on('click', function () {
$("#Button2").show();
});
});
</script>
$(function () {
$("#Button1").on('click', function () {
$("#Button2").show();
});
});
<script src="https://ajax.googleapis./ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="rightdiv">
<div id="BTNONE">
<button type="button" ID="Button2" value="New Tab" style="display: none;" />
Button 2
</button>
<button ID="Button1" value="Button" />Button 1</button>
</div>
</div>
本文标签: javascriptDisplay button on button clickStack Overflow
版权声明:本文标题:javascript - Display button on button click - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744223779a2595993.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论