Can't select next span AND next image
I'm trying to do a form with hints when you click on each field.
So I have this code:
-
$(document).ready(function(){
<script>
$(document).ready(function(){
$("input").focus(function () {
$("#legende").show();
$("#legende").html($(this).next("span").html());
$(this).next("img").show();
});
$("input").blur(function () {
$("#legende").hide();
$(this).next("img").hide();
});
});
</script>
<legend>Registrazione</legend><div id="legende"></div>
<label for="username">Username:</label><input type="text" name="username" /><img src="images/pointer.gif" /><span>Username info</span><br />
<label for="email">email:</label><input type="text" name="email" size="40" maxlength="100" /><span>valid email please.</span><br />
<label for="email_confirm">Confirm email:</label><input type="text" name="email_confirm" size="40" maxlength="100"><span>confirm your email</span><br />
<label for="password">Password:</label><input type="password" name="new_password" size="25" /><br />
<label for="password_confirm">Confirm Password:</label><input type="password" name="password_confirm" size="25" /><br />
<br /><input type="hidden" name="accordo" value="true" />
'username' has the image AND span, but when I click on it the image is shown, as well as the div legende, but with no text in it.
Other inputs, like 'email', are ok, they display the div legende with the correct html in it; in this case its 'valid email please.'.
How do I get both working? Thanks