I want my datepicker to open only under condition, in this case the presence of a class, here's the not working code:

```
$('.ui-datepicker-trigger').click(function(e){
    if ($(this).hasClass('disableDatepicker')) {
        e.preventDefault();
    }
});

```

Thanks!