SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    3MTA3
    Join Date
    Jul 2003
    Location
    Florida
    Posts
    1,016
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ding sound when clicking enter key

    I have a dropdown div menu beneath a text field and when the user selects an option from it and hits the enter key, it populates that field with the option they selected. It populates fine, but for some reason in IE it causes the ding/bell sound to play when you hit enter. I don't see any JavaScript errors displayed in the status bar. Any ideas what may be causing this or how I can do away with the sound?

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    This is because newline symbol is invalid to enter into a text field. Pressing ENTER means that, so IE plays the sound. Maybe capturing the key press event would help.
    Saul

  3. #3
    3MTA3
    Join Date
    Jul 2003
    Location
    Florida
    Posts
    1,016
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by php_daemon
    This is because newline symbol is invalid to enter into a text field. Pressing ENTER means that, so IE plays the sound. Maybe capturing the key press event would help.
    It's currently setup to capture the key press event and when it's the enter key, it populates the text field with the contents of the selected div. Can you explain a little more about how you would capture the key press event to bypass the sound?

    Thanks for the help.

  4. #4
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    In the capture function, return false if it's the enter key pressed. Not sure if this will disable the sound, but try it out and see. I can't think of any other way, if this won't work then there's no way you can disable it.
    Saul

  5. #5
    3MTA3
    Join Date
    Jul 2003
    Location
    Florida
    Posts
    1,016
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sounds like I'm screwed then. The client wanted to use the enter key to populate the text field with the content that is within the selected div.


Bookmarks

Posting Permissions

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