Jquery code preview


#1

Hello,
The bug I would like to report is a bug in general, it does not occur only in this lesson but also in previous lessons.

As you see on the little preview window everything looks ok and when the Add button is pressed it appends stuff. But when I focus on the text input field and if I press enter after, everything on that window disappears.

Thank you.


#2

Could you provide the script.js code you are using in ASCII format...


#3

Hi, it is the default of the lesson, I havent changed anything.

$(document).ready(function() {
$('button').click(function() {
var toAdd = $("input[name=message]").val();
$('#messages').append("

"+toAdd+"

");
});
});

#4

Are you looking for
https://stackoverflow.com/questions/1626107/text-in-html-field-to-disappear-when-clicked


#5

Nope, I think I didnt explain it clear. What I am reporting is a bug that in jquery lessons (I tried it on a few). When there is an input field, and if I press enter after focusing in this input field everything in that white little preview window disappears. Could you please go to the lesson of Review of jQuery Events and as soon as it opens focus on the input field(whether there is something written or not) then press Enter? I apologise that I am not good at explaining stuff but I believe you will get my point if you can try it as I did so.

Thank you!


#6

It seems that the HTML DOM has a "form" element that seems even unnecessary in the lesson, thus whenever Enter is pressed it tries to redirect the page to an non exiting one. I am not in the position to suggest a solution to CodeAcademy but I would like to know why there is a "form" element ?


#7

Maybe you are looking for
https://www.codecademy.com/en/forum_questions/51c474809c4e9d22aa000700
or
https://stackoverflow.com/questions/11235622/jquery-disable-form-submit-on-enter


#8

:thumbsup:

Thank you !


#9

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