Reputation: 279
Code:
$(document).ready(function() {
$("#main_div").bind('click', function(e){
var x = event.pageX-document.getElementById("main_div").scrollLeft;
var y = event.pageY-document.getElementById("main_div").scrollTop;
document.pointform.form_x.value = x;
document.pointform.form_y.value = y;
var a= x-404;
var b= y-88;
if(document.getElementById('optionselect').value=='a')
{
$("#container-5").css({"top":b,"left":a});
$("#container-5").show();
e.stopPropagation();
}
else if(...)
{
...
}
});
});
Hey Guys, the code is working fine in IE and Chrome but when i try to run the same in firefox it throws an error 'event is not defined' and points the cursor where var x is defined. How do i overcome this problem?
Upvotes: 0
Views: 1079
Reputation: 55750
Try
$("#main_div").bind('click', function(event){ // Cause you seem to use
// event argument and not e
Instead of
$("#main_div").bind('click', function(e){
Also Change e.stopPropagation()
;
to
event.stopPropagation();
Upvotes: 0
Reputation: 4669
Change
$("#main_div").bind('click', function(e){
To
$("#main_div").bind('click', function(event){
And everything should be alright :)
Upvotes: 1