user3492649
user3492649

Reputation: 21

Double click Trigger event to clear textbox

I 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-clicked

The 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

Upvotes: 2

Views: 3708

Answers (1)

martynas
martynas

Reputation: 12300

Try this:

$("#myTarget").on("dblclick", function() {
    // Do stuff...
});

DEMO

Upvotes: 1

Related Questions