Append to body


#1

https://www.codecademy.com/courses/web-beginner-en-v6phg/2/3?curriculum_id=50a3fad8c7a770b5fd0007a1#

When enter is pressed, the page disappears? Why is that?

Replace this line with your code.


#2

It has to do with the lesson interface being in an iframe. The Enter key is bound to the main document, not the embedded one. Solution,.. Don't use the Enter key to submit.

There is a bit of code that will prevent this from happening, but it is not part of the lesson or exercise.

    $("input").keypress(function (evt) {
        var charCode = evt.charCode || evt.keyCode;
        if (charCode  == 13) {
          return false;
        }
    });

#3

I felt like I was never going to understand JavaScript, but jQuery, Eloquent JavaScript, you, and Stetim have made it 10 times easier. There are a lot of us on here that appreciate your help.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.