I have the following code:
(function(jQuery){
jQuery.fn.timepicker = function(){
return this.each(function(){
jQuery(this).val("14:00");
});
};
})(jQuery);
Currently I invoke this function by the following code: $("#event_start_time").timepicker();
Where #event_start_time
is the ID of an <input>
field.
I do not want to invoke the plugin by using something like this:
$('#event_start_time"').click(function() {
this.timepicker();
});
How can I invoke this code only when I click inside the text box?