[jQuery] How do I invoke custom plugin on click?
- by Steven
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.
How can I invoke this code only when I click inside the text box?