I having difficulty in meeting add an event click on a div tag with runat = “server”.
This works perfectly on IE but not on chrome, mozilla .. Search error 🙂
Here is the code I tried
JAVASCRIPT:
function showAlertAnomalie() {
alert("Handler test");
}
ASP:
<div id="btn_alert_anomalie" class="alertAnomalieClass" runat="server" onclick="showAlertAnomalie" >
<asp:Label runat="server" Text="Alert annomaly" Font-Bold="true" Font-Size="12" ForeColor="White" style="cursor:pointer;"></asp:Label>
</div>
I ave also try this but not work.. :
$("#btn_alert_anomalie").click(function () {
alert("Handler test");
});
An inline
onclickattribute is supposed to contain the body of the click handler, not the name of it. Try this:Here is a demonstration: http://jsfiddle.net/UgcEQ/
The problem was that doing this:
is equivalent to doing this:
which doesn’t really do anything.