フォームの外側に入力と div コンテナを含むフォームがあり、各入力のヘルプ テキストがあります。
<form>
<input id="name" />
<input id="email" />
<input id="pass" />
</form>
<div class="help-container">
<p class="help-name"></p>
<p class="help-email"></p>
<p class="help-pass"></p>
</div>
.help-container は最初は { display: none; で非表示になっています。} および各子 p.
私が問題を抱えているjQueryは次のとおりです。
$("form").find("input").focus(function(){
var parent = $(this).attr("id");
$(this).closest("form").next(".help-container").show();
})
1) これは機能しません。なんで?
$("form").find("input").focus(function(){
var parent = $(this).attr("id");
$(this).closest("form").next(".help-container").show();
$(".help-container").children("p").hide();
$(".help-container").children("p").find(".help-" + parent).show();
})
2) これは機能しません。なんで?