Jquery prev()不能使用输入

use*_*449 0 jquery tree-traversal

我不能用prev改变css,我的错误在哪里?Fiddlelink

坦克寻找!


CSS:

.i1 {
    float: right;
    height: 18px;
    margin-top: 6px;
}
label {
    border-bottom: 1px dotted #CCCCCC;
    clear: both;
    float: left;
    height: 25px;
    margin: 5px 0 0;
    width: 450px;
    line-height: 32px;
}
Run Code Online (Sandbox Code Playgroud)

HTML:

<label>Titel:<input class="i1" type="text" name="titel" value="" /></label>
<label>Vorname:<input class="i1" type="text" name="vorname" value="" /></label>
<label>Nachname:<input class="i1" type="text" name="nachname" value="" /></label>
Run Code Online (Sandbox Code Playgroud)

jQuery的:

  $("input").focus(function () {
    $(this).prev("label").css("border-bottom", "1px dotted #63aec4");
  });
Run Code Online (Sandbox Code Playgroud)

Cal*_*lum 5

$(this).parent("label").css("border-bottom", "1px dotted #63aec4");
Run Code Online (Sandbox Code Playgroud)