jquerytools/jquerytools — Issue #629: DateInput API Call from within a Click Event
Author: khanh
Created: 2012-01-23 01:01:26+00:00
State: open

-Tried this on Firefox & Chrome
-Using Jquery Tools 1.2.6 min.js with jquery (http://cdn.jquerytools.org/1.2.6/full/jquery.tools.min.js) as well as Jquery 1.7.1 unminfied & Jquery Tools 1.2.6 unminified.

var api = $("#calendar_input").data("dateinput");
$("#my_calendar").click( function() {
api.show();
});

This doesn't work, but if I change "click" to hover like so:

var api = $("#calendar_input").data("dateinput");
$("#my_calendar").hover( function() {
api.show();
});

Then it works, but clearly I don't want it to show on a hover. I've also tried doing this like so :

$('#my_calendar').click(function() {
$('#calendar_input').trigger("focus");
});

But this just selects the text in the Input field.

The wierdest part of all of this is both methods work from within the console (firebug, chrome console), but not from within my code. I've got a demo located here:

Demo : http://dl.dropbox.com/u/4594954/dateinput-activate-with-button.zip