I have a simple div.
<div id="error" class="notifications" runat="server" visible="false" ClientIDMode=Static></div>
As you notice this div has runat="server"
so I can manipulate it from Server, as well as ClientIDMode=Static
so that the Server does not change the ID, and visible="false"
to make it hidden from the beginning.
After executing some codes in ASP, I am showing the div via:
error.Visible = true;
Now I made a small JQuery function to hide this div in case I click on it.
$("#error").click(function() {
$(this).fadeOut();
});
This did not work, I also replaced $("#error")
with $(".notifications")
yet no success.
Note: If I remove visible=false
and I click on it, it will disappear, it's working.
UPDATE I forgot to mention that both the button that shows the div when I click on it, and the div, are both inside an UpdatePanel
(for Ajax), when I placed them outside of it, everything worked (but with a page refresh).