san1 Posted May 6, 2014 Share Posted May 6, 2014 HiI would need to add an event handler for a double-click event of a text box. I'm trying to trigger the click event of clear button from the handler for the double-click event. This should clear text from the textbox that is double-clickedThe code for the clear button works from the following code:$("#clear_entries").click(function () {$("input[type=text]").val("");$("input[type=text]").after("");$("#email_address1").focus();});$("#email_address1").focus();});I am trying to use the shortcut for trigger method using $("#clear".click();Any help is appreciated. Thanks Link to comment Share on other sites More sharing options...
justsomeguy Posted May 6, 2014 Share Posted May 6, 2014 I'm not sure if jQuery has a double-click event. If not, you need to make it yourself. The way you do that is on each click, you check the time of the last click (if there was one). If the time between the current click and the last click is less than a threshold, then you consider it a double-click and perform the action. If it's out of range then you just record the current time as the last click. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now