Menu

Error: Uncaught TypeError: Cannot read property '_doCheckMouseClick' of undefined

Help
Robert C
2015-03-26
2015-03-31
  • Robert C

    Robert C - 2015-03-26

    ASP.net 4.5 w/ Master page. I am getting the above error when implementing your plug-in (not to sound negative, just wanting to show it could be implemented for our users). I have the following in the header of the Site.Master page:
    <script type="text/javascript" src="Scripts/jquery.dimensions.js"></script>
    <script type="text/javascript" src="Scripts/jquery.ptTimeSelect.js"></script>
    <link rel="stylesheet" type="text/css" href="Content/themes/base/jquery.ptTimeSelect.css"/>

    Thanks in advance for you help.

     

    Last edit: Robert C 2015-03-26
  • Paul T

    Paul T - 2015-03-26

    Hi Robert...

    • I don't see jQuery above... is it also included in the page? Also, what version of jQuery are you using?
    • Whats actually happening, other than you see an error in the console? does the widget actual show up when the user clicks on the input field?
    • Can you post your code that initializes the timepicker on the input fields?
    • What browser (including version) are you using?
    • When viewing the demo page (here), do you see the error?

    Thanks.

     
  • Robert C

    Robert C - 2015-03-27

    Thanks for your reply:

    Scripts/jquery-1.8.2.js, Scripts/jquery-1.8.2.min.js, Scripts/jquery-ui-1.8.24.js
    Scripts/jquery-ui-1.8.24.min.js. They are included on the page. I confirmed it using Developer Tools in Chrome

    * The widget doesn't show when I click in the textbox.

    * I'm using Chrome version 41.0.2272.101

    * No, I don't see the error on the demo page

    * Page that initialize the widget to the input fields
    <%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="myPage.aspx.cs" Inherits="myPage" %>

    <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" Runat="Server">

    <script type="text/javascript">
    $(document).ready(function () {
    $('#myPage input').ptTimeSelect();
    });
    </script>
    </asp:Content>

    * Below is the head section of the Site.Master page:
    <head runat="server">
    <meta charset="utf-8"/>
    My Title
    <asp:PlaceHolder ID="PlaceHolder1" runat="server">

        <%: Scripts.Render("~/bundles/modernizr") %>
        <%: Scripts.Render("~/bundles/jquery") %>
        <%: Scripts.Render("~/bundles/jqueryui") %>
    
    </asp:PlaceHolder>
    <webopt:BundleReference runat="server" Path="~/Content/css" />
    <webopt:BundleReference runat="server" Path="~/Content/themes/base/css" /> 
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    
    <link rel="stylesheet" type="text/css" href="Content/themes/base/jquery.ptTimeSelect.css" />    <script type="text/javascript" src="Scripts/jquery.dimensions.js"></script>
    <script type="text/javascript" src="Scripts/jquery.ptTimeSelect.js"></script>
    
    <meta name="viewport" content="width=device-width" />
    <asp:ContentPlaceHolder runat="server" ID="HeadContent" />
    

    </head>

     
  • Paul T

    Paul T - 2015-03-27

    The order in which these are included on the page also matter... it should be jQuery, jQuery UI and then the time select widget.

    In your code above where you call .ptTimeSelect(), replace it to to this:

    <script type="text/javascript">
    $(document).ready(function () {
        console.log("jQuery version: " + $.fn.jquery);
        console.log("ptTimeSelect version: " + $.ptTimeSelect.version);
        console.log("is ptTimeSelect plugin loaded? : " + ($.fn.ptTimeSelect ? "YES" : "NO"));
        console.log("does #myPage input exist? : " + ($('#myPage input").count() ? "YES" : "NO" ) );
        $('#myPage input').ptTimeSelect();
    });
    </script>
    

    This will output a few statement to the browser's console... Let me know what those are.

     
  • Robert C

    Robert C - 2015-03-27

    See attached.

     
  • Paul T

    Paul T - 2015-03-27

    Thanks. Sorry to do this. I had a mistake in the above snippet I gave you. Can you replace .count() with .size() on the line that checks if your selector is found, and run it again?

     
  • Paul T

    Paul T - 2015-03-27

    I just setup a quick demo here: http://jsbin.com/qodoko/1/ and it worked... jsBin does not have v1.8.2 of jQuery available, but I can't see how that would generate the error you are seeing.

     
  • Robert C

    Robert C - 2015-03-31

    It works....Thanks. I verified that jQuery, jQuery UI are in the correct sequence, placed before ptTimeSelect. I removed them from the 'Bundle' in BundleConfig.cs. I may try to set it up using the Bundle approach but for now that will wait. Thanks for you input.

     
  • Paul T

    Paul T - 2015-03-31

    Ok.. Good.. GLad to hear that.

     

Log in to post a comment.