February 5th, 2014, 03:34 AM
-
Question Event does not run when I click image that has event attached to it
Hello Everybody,
I would like to know if there is something I am missing why my ASP.NET is not running the script that is embedded in the master page, I imagine that it should be running in any page using the master page (where I have the event embedded) as shown in my screenshot but to my surprise it doesn't run the alert message ..
When I click any of the images I am not seeing the alert box that I am expecting as a response to the click event ..
My code is shown below .. any help much appreciated .. thanks again:
Code:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="SiteMaster" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<title></title>
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
<script src="Scripts/jquery-1.4.1.js" type="text/javascript" >
$('.main').ready(
function () {
alert('hello');
});
$('img').click(
function () {
alert('hello from image');
});
</script>
<script src="Scripts/myJavascriptTools.js" type="text/javascript" >
</script>
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
February 5th, 2014, 07:09 PM
-
CLOSED .. case in now Closed -- Solution is to call JQuery after the form loaded..thx
Originally Posted by versm1ca
Hello Everybody,
I would like to know if there is something I am missing why my ASP.NET is not running the script that is embedded in the master page, I imagine that it should be running in any page using the master page (where I have the event embedded) as shown in my screenshot but to my surprise it doesn't run the alert message ..
When I click any of the images I am not seeing the alert box that I am expecting as a response to the click event ..
My code is shown below .. any help much appreciated .. thanks again:
Code:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="SiteMaster" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<title></title>
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
<script src="Scripts/jquery-1.4.1.js" type="text/javascript" >
$('.main').ready(
function () {
alert('hello');
});
$('img').click(
function () {
alert('hello from image');
});
</script>
<script src="Scripts/myJavascriptTools.js" type="text/javascript" >
</script>
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
-----------------------------
CLOSED .. case in now Closed -- Solution is to call JQuery after the form loaded..thx