I am trying to do, so when a user marks/put focus on an input field, a div should appear below with text. Currently I have this:
<div class="field">
<label for="email" class="label">E-mail:</label>
<input id="email" name="email" size="50" id="emailField" type="email" value="" />
</div>
<div id="emailNoti"></div>
This is my current JS code:
$("#emailField").focus(function() {
$("#emailNoti").html("You have now pressed the field. Start typing");
});
Yet nothing happens. No div appear
Your input has two IDs which is illegal and the reason why you can not select it with
$("#emailField"). Removeid="email"orid="emailField".Furthermore you can use the
text()method instead ofhtml()when inserting text only.