I have some problem with hiding/unhiding the div element. I have input element who is filled by datepicker. If that input element is empty (always on start) the div element should be hidden. I have this code:
$("#input#date_from").keyup(function () {
if ($(this).val()) {
$("#return_section").show();
}
else {
$("#return_section").hide();
}
});
but it didn’t work. The div element is still visible, and I don’t know where is the problem?
Thanks, for any help!
If the
#date_frominput is filled by the datepicker, it’s probably better to usechange()instead ofkeyup()as it watches for a change in the value of the input, as opposed to keyboard strokes. I would also explicitly check if the input field is empty.