www.webdeveloper.com
Results 1 to 5 of 5

Thread: case String.fromCharCode(13) ??

  1. #1
    Join Date
    Oct 2012
    Posts
    7

    case String.fromCharCode(13) ??

    Hi,

    I am writing a small js app... I need to use Switch and case for to process a string (textarea).

    I don't know why but I am unable to make the script recognize the "Enter key":

    case String.fromCharCode(13) :
    w = w+String.fromCharCode(13);
    break;

    All other chars work fine es:
    case String.fromCharCode(32) :
    w = w+String.fromCharCode(32);
    break;

    Only Enter is not working...

    Any idea?
    thx

  2. #2
    Join Date
    Jan 2011
    Posts
    123
    I understand but what's not working?

  3. #3
    Join Date
    Oct 2012
    Posts
    7
    When i type some text in the textbox, all character are recognized but enter.

    ex:

    I type in my textbox:
    "Hello
    world"

    i get back "Helloworld" enter is ignored. If i type "Hello world" i get "Hello world" the space is recognized.

    I would like my app to work also when i press enter and not to ignore it.

    I made a similar app with Flash and it works without problems.

    thx

  4. #4
    Join Date
    Nov 2010
    Posts
    1,088
    are you sure it's 13? I thought it was, too, but it seems like in a text area it might be 10...
    Code:
    <textarea onkeyup="alert(this.value.charCodeAt(this.value.length-1))"></textarea>

  5. #5
    Join Date
    Jan 2011
    Posts
    123
    you need to describe the whole scenario, this doesn't help identify the cause. On top of that we will need to know if the behavior is consistent on all browsers.

Thread Information

Users Browsing this Thread

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

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