Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery's key events not firing when with prototype
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/1331505/jquery-and-prototype-events">jQuery and Prototype events</a> </p> </blockquote> <p>I am using the Box2dJS library, and it uses prototype, so I had to include the prototype library for it to work. I am not using any prototype code in my main script, only the Box2d objects use prototype. I am using JQuery in my script, and since I included prototype, it seems that the jQuery events aren't firing. </p> <p>Here is the relevant JS code:</p> <pre><code>$.noConflict(); jQuery(document).ready(function(){ init(); }); function init(){ //add event handler to surrounding DIV to monitor mouse move and keystrokes jQuery("#container").keypress(function(e){ keys[e.keyCode] = true; alert("key pressed!"); }); jQuery("#container").keydown(function(e){ keys[e.keyCode] = true; }); jQuery("#container").keyup(function(e){ keys[e.keyCode] = true; alert("Key released!"); }); } </code></pre> <p>And here is the html code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Box2D Test&lt;/title&gt; &lt;!--[if IE]&gt;&lt;script src="lib/excanvas.js"&gt;&lt;/script&gt;&lt;![endif]--&gt; &lt;script src="lib/prototype-1.6.0.2.js"&gt;&lt;/script&gt; &lt;!-- box2djs scripts here--&gt; &lt;/head&gt; &lt;body&gt; &lt;center&gt; &lt;div id="container" style="border:1px solid; cursor:none; width:600px; height:400px;"&gt; &lt;canvas id="canvas" width="600" height="400" &gt; Could not create Canvas! &lt;/canvas&gt; &lt;/div&gt; &lt;script type="text/javascript" src="jquery-1.6.2.min.js"&gt;&lt;/script&gt; &lt;script src='js/box2dutils.js'&gt;&lt;/script&gt; &lt;script type="text/javascript" src="main.js"&gt;&lt;/script&gt; &lt;/center&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>None of the alerts are going off, but everything works a-ok when I remove the prototype (and the box2d) library. How can I fix this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload