Subscribe to Who needs shades of grey?        RSS Feed
-----

Internet Explorer is my bi-atch.

Icon Leave Comment
So in real browsers, if you bind something to an element's click event, your handler returns false in order to stop the even bubbling. It's fairly simple.
In jQuery, for example,
$('a.thingy').click(function(){
   // do something
   return false'
});


This essentially hijacks the click and replaces the default behaviour with whatever you code.
On form elements, it's the same.
$('input[type=radio]').change(function(){
    // do something
    return false;
});



The catch here is that you don't need to return false because you don't need to prevent an action such as an anchor's page location change. This caught me out because in real browsers it doesn't matter, but in Internet Explorer the event fires for every element in the radio group, or the existing and new options in a select box. Returning false, in essence, tells IE to move on to the next element's event. So don't do it. Either return true or - simpler - just don't return anything. Then IE will behave like the rest of the world.

0 Comments On This Entry

 

July 2014

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728 29 3031  

Recent Entries

Recent Comments

Search My Blog

0 user(s) viewing

0 Guests
0 member(s)
0 anonymous member(s)