0

Basically, I have an HTML and JS code that makes few input tags on the page (text boxes). Those boxes appear when I press the buttons on the screen (just some JS configuration (playing with hide(), show() and append())).

Well, I wanted them to append their value to some tags in HTML when I press specific button on the screen. So I did. But I can't make them do that by pressing "Enter" and the "arrow enter" (mobile devices).

I tried .keyup(), but that does the thing only if the boxes are static, but I gave them the option to appear and disappear. (In the beginning I press a button - one appends to HTML with another 2 buttons (first to hide it, second is like "enter")). Pressing enter doesn't help when they are dynamic.

Well, I need this "enter" functionality (better on keyup() some how).

I've tried this code:

$(document).keyup(function() {
    $('#myText').keyup(function(e) {
        if (e.keyCode == 13) {
            alert("Enter pressed");
        }
    });
});

Then:

$(function () {
    $('#myText').keyup(function(e) {
        if (e.keyCode == 13) {
            alert("Enter pressed");
        }
    });
});

$(#myText).keyup(function() {
    if (e.keyCode == 13) {
        alert("Enter pressed");
    }
});

and many others. It works only on static ones.

Regent
  • 5,142
  • 3
  • 21
  • 35

0 Answers0