Results 1 to 7 of 7
  1. #1
    san1 is offline Member
    Join Date
    Feb 2014
    Posts
    9
    Rep Power
    0

    Default JQuery - Double click Trigger event to clear textbox

    Hi

    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

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,417
    Rep Power
    25

    Default Re: JQuery - Double click Trigger event to clear textbox

    What language is that code?
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    947
    Rep Power
    2

    Default Re: JQuery - Double click Trigger event to clear textbox

    What worries me is that you ask for Javascript help at a Java forum. Java !== Javascript.

    Oh, and:
    $('#mytextbox').dblclick( function() {
    $(this).val('');
    });

    .dblclick() | jQuery API Documentation
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  4. #4
    san1 is offline Member
    Join Date
    Feb 2014
    Posts
    9
    Rep Power
    0

    Default Re: JQuery - Double click Trigger event to clear textbox

    Thank you! The following code worked:

    $("input:text").dblclick( function(){
    $(this).val('');
    });

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,029
    Rep Power
    6

    Default Re: JQuery - Double click Trigger event to clear textbox

    You apparently ignore the link to the documentation, the only important part of his reply.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    947
    Rep Power
    2

    Default Re: JQuery - Double click Trigger event to clear textbox

    Quote Originally Posted by gimbal2 View Post
    You apparently ignore the link to the documentation, the only important part of his reply.
    Hey!! I resent that :) The code example was important too! I saved this guy about four hours of reading boring documentation! That's gotta be worth something?
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  7. #7
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,029
    Rep Power
    6

    Default Re: JQuery - Double click Trigger event to clear textbox

    Quote Originally Posted by SurfMan View Post
    Hey!! I resent that :) The code example was important too! I saved this guy about four hours of reading boring documentation! That's gotta be worth something?
    Yes: a slap on the wrist. You prevented someone from reading documentation and actually growing as a person. BAD SUFDUDE!
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Replies: 2
    Last Post: 06-22-2011, 01:19 PM
  2. Which combobox event to use to fill a textbox
    By aborgeld in forum New To Java
    Replies: 4
    Last Post: 01-03-2011, 05:18 PM
  3. Double click event
    By Dipke in forum New To Java
    Replies: 3
    Last Post: 10-22-2010, 11:39 AM
  4. Trigger an Event
    By koxy in forum Advanced Java
    Replies: 1
    Last Post: 03-24-2010, 07:45 AM
  5. programmaticly trigger an event
    By maxim in forum AWT / Swing
    Replies: 3
    Last Post: 02-23-2009, 03:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •