0

i have this line of code it works in google chrome but not in mozilla firefox.

$("body").on("click",".removeclass", function(){  
  event.returnValue = false; 
  if( i > 1 ){ 
    $(this).parents('span').remove();
    i--; 
  } 
}); 

do you have any idea?

Amit Soni
  • 1,437
  • 1
  • 9
  • 18
user310193
  • 11
  • 5

2 Answers2

1

You forgot to pass event to the function like so:

$("body").on("click",".removeclass", function(event){ 
   event.returnValue = false;
   if( i > 1 ){ 
       $(this).parents('span').remove();
       i--;
   }
});


More info in this post.

Community
  • 1
  • 1
  • it a line o code to delete an input of file in chrome it works but on firefox when i click the delete button the page refresh – user310193 Mar 26 '15 at 17:01
0

the solution was to modify getPreventDefaul() with defaultPrevented() on jquery.js and

$("body").on("click",".removeclass", function(){  
event.returnValue = false; 
if( i > 1 ){ 
$(this).parents('span').remove();
i--; 
} 
});

with

$("body").on("click",".removeclass", function(event){  
event.returnValue = false;
if( i > 1 ){ 
$(this).parents('span').remove();
i--; 
} 
});
user310193
  • 11
  • 5