www.webdeveloper.com
Results 1 to 10 of 10

Thread: JavaScript Event Trigger

  1. #1
    Join Date
    Jun 2011
    Posts
    43

    Talking JavaScript Event Trigger

    I have a form that has some text fields . Here is what my script does :

    1. Get a text box and put something in it (some text).

    Heres what i want it do

    1. After putting text press enter key . Now i know that there are some event
    trigger like .click() that clicks so i was wondering may be there is some trigger
    that presses enter key .

    Help me

  2. #2
    Join Date
    Aug 2007
    Posts
    3,767
    Well presumably you want to submit a form? You'd have to show some code, and then call that function that is called with the form submits.
    Great wit and madness are near allied, and fine a line their bounds divide.

  3. #3
    Join Date
    Jun 2011
    Posts
    43
    Yes i want a java script to submit a form by filling up the text fields. But there's no submit button .The only way to submit is pressing enter key . How can i use java script to press enter key.

  4. #4
    Join Date
    Aug 2007
    Posts
    3,767
    Use the .submit() function of the form.
    Great wit and madness are near allied, and fine a line their bounds divide.

  5. #5
    Join Date
    Oct 2010
    Location
    Versailles, France
    Posts
    1,264
    You can use this function

    window.document.onkeyup=function(e){var k=e?e.which:window.event.keyCode;
    if (k==13) myForm.submit();
    }

  6. #6
    Join Date
    Jun 2011
    Posts
    43
    But how do i trigger keyCode 13 using java script...

  7. #7
    Join Date
    Oct 2010
    Location
    Versailles, France
    Posts
    1,264
    Press Enter to trigger KeyCode 13 !

  8. #8
    Join Date
    Jun 2011
    Posts
    43
    i want javascript to press enter

  9. #9
    Join Date
    Oct 2010
    Location
    Versailles, France
    Posts
    1,264
    Javascript to presse enter and pay with paypal ?

  10. #10
    Join Date
    Jun 2011
    Posts
    43
    No. javascript to press enter and auto submit my comments in my facebook profile

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles