Jump to content

Double click Trigger event to clear textbox

Recommended Posts

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 post
Share on other sites

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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...