Hi,
i'm developing an app like google calendar. I've one field to add the time. Like google calendar, when i focus on time field, with jquery i create a div with a list of possible times (10.00, 10.30, 11.00, 11.30..... etc). When i click on one hour, triggers a remove event to delete the dv with the list of "times".
My problem...
i need that the div created being removed when I click on other field. I try this:
$("#time").blur(function() {
$(#times).remove();
})
But when i click on one hour created into the "times" div, the blur event is triggered and the div dissapear (and the click event don't start)
Here some code:
<script type="text/javascript">
$(document).ready(function(){
$("#time").click(function() {
// crida a funció per crear temps
var combo = createTimeCombo(); //the function createTimeCombo returns something like:
//"<div id='time-combo"><div>10.00</div><div>10.30</div></div>";
//posicionar el combo
offset = $(this).offset();
$(this).after(combo);
$("#time-combo").css({'position':'absolute','top':offset.top + 20,'left':offset.left, 'width':$(this).width()});
$("#time-combo div").click(function(){
$(this).parent().prev().val($(this).html());
$(this).parent().remove();
});
});
$("#time").blur(function() {
// $("#time-combo").remove();
});
});
</script>
thankyou!!
Joan Teixidó