1.Because you given value to the field not the default text.
2. default text is about to appear as for the ease for the user and when they click on the field that text disappear while what you did you just given a value to the field.look at the link above and you will experience that what is it about
However, it seems that your code has a flaw. What do you think if I am not using an updated browser and enter only white spaces in the field? One should not assume that all users have the same computer knowledge...
this is a tutorial for having default text and if i have used some short path its all for the sake of tutorial guys..all you need to known is how we can apply the defalut text specially this tutorial for type email to them and dont think it has any flaw regarding the code
Hmm... So you don't have a though of older version of a browser that does not accept HTML5? The purpose of your script is supposed to "redisplay" the text if the field is empty. However, if the type of "email" does not apply because it is not HTML5 and a user enter 1 space, it would look empty and by pass your check. If you are giving a tutorial, it is fine. However, you need to explain what your tutorial does not offer or those who want to learn need to look for in the future.