Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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>

  • #2
    New to the CF scene
    Join Date
    Feb 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    CLOSED .. please consider this case as now Closed -- Solution is to call JQuery event after the form loaded.. also preferably to put the code before the </body> tag .. thx


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •