Long Press - ASP.NET
<p>I am in the process of handling a Long Press event in the JavaScript of an ASPX page but since I don't have much experience with JavaScript having a couple issues.  I am working of a question which was <a href="http://stackoverflow.com/questions/2625210/long-press-in-javascript">already asked here</a>.</p>

<p>When I run the code I get the message "$ is not defined" and when I change $("Button1") to ("Button1") then I get the message stating the mouseup function doesn't exist.  The primary problem I'm having is accessing the aspx control properly.  Below is my code.</p>

<pre><code>&lt;%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head runat="server"&gt;
    &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" language="javascript"&gt;
        $(function () {
            var pressTimer;
            var longPress = 1000;

            $("#&lt;%= Label1.ClientID %&gt;").bind("touchend", function (e) {
                var d = new Date();
                var timeDiff = d - pressTimer
                if (timeDiff &gt; longPress) {
                    document.getElementById("demo").innerHTML = "Mouse Up";
                    //actual logic here
                }
                return false;
            });
            $("#&lt;%= Label1.ClientID %&gt;").bind("touchstart", function (e) {
                pressTimer = new Date();
                return false;
            });
        });
    &lt;/script&gt;
    &lt;title&gt;Long Press Testing&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form id="form1" runat="server"&gt;
    &lt;div&gt;
        &lt;asp:label ID="Label1" runat="server" text="Hold This Down" /&gt;
        &lt;br /&gt;
        &lt;p id="demo"&gt;&lt;/p&gt;
    &lt;/div&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Thanks for the help.</p>

<p>[EDIT] - Turns out I was missing the ready statement so the event is now firing as it should.  This is the final version which is behaving properly.  Also I wrote this to handle long press functionality on the iPad so if anyone is trying to do that this code is a good place to start.</p>
