Since I'm creating a HTA code I'm stuck with IE :(
We needed to trap the change event in a <select>
element, but guess what, IE does not support that event.
So I created a way to mimic it. With a <input type="text">
that when it is being click show the <select>
just below. That part works fine. The problem is, I want to hide the select
when the user click outside the select
.
I tried to catch a click
on the body
, it works fine the first time but the second time the select
gets hidden try away.
Here a simplify version of the code:
$('.product').live('click',function(){
// Show the <select id="select"> code goes here
// this is the event to close the select
$('body').die().live('click', function(){ $('#select').fadeOut(250); return;});
// get the click on the select element
$('#select').die().live('click',function(){
// kill the close the select
// THIS IS THE .die() THAT DOES NOT WORK
$('body').die();
});
Question Is there something wrong with this code? OR is there a better way to do this? Remember I'm stuck with IE.