troubleshooting Question

onClientClick not happening

Avatar of QPR
QPRFlag for New Zealand asked on
ASP.NET
5 Comments1 Solution312 ViewsLast Modified:
Not sure if I've got the JS wrong or the .net code wrong but....
I have an asp button and I added the property onclientclick, I'm trying to set a DIV to visible when the button is clicked. The page refreshes but the DIV is still hidden any ideas?

<script type="text/javascript">
<!--
function toggle_visibility(id) {
var e = document.getElementById(id);
//if(e.style.display == 'none')
e.style.display = 'block';
//else
//e.style.display = 'none';
}
//-->
</script>

<asp:Button ID="AddMe" runat="server" Text="Add" OnClientClick="toggle_visibility('NewAbs')" />

<div id="NewAbs" style="visibility: hidden"> <table cellpadding="4" cellspacing="4" border="1">
some stuff in here
</table>
 </div>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros