3
votes

trying to make a lightbox work on my server , but i get theese 2 errors

Uncaught TypeError: Object [object Object] has no method 'attachEvent' prototype.js:6490 Uncaught TypeError: Object [object Object] has no method 'dispatchEvent' prototype.js:6598

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="\Content\js\lightbox.js"></script>
<link rel="stylesheet" href="\Content\css\lightbox.css" type="text/css" media="screen">
1
The "attachEvent" API is an Internet Explorer thing. - Pointy
Looks like you're having some library conflicts. - Kevin B
Probably due to you including jQuery and Prototype, both of which want to bind to $. - alex

1 Answers

3
votes

You could make jQuery bind to a variable you assign instead, to remove any conflicts going on, as alex says in the comments... An example, from the jQuery website would be

// Line that tells jQuery to bind to "j" and not $
var j = jQuery.noConflict();

// Do something with jQuery
j( "div p" ).hide();

// Do something with another library's $()
$( "content" ).style.display = "none";

Obviously change the code to your preferences, this code is just an example.