2015-06-23 35 views
-1

我有下面的代码:CSS选择

<div> 
    <div> 
    <input/> 
    </div> 
    <div class='error'> 
    </div> 
</div> 

我需要如果input:focus然后div.error必须显示无

+0

你可以请你重提你的问题吗?你的意思是如果输入焦点,你想div.error显示没有? –

+0

是的。对不起的措辞感到抱歉) – Alexander

+0

如果你不能重写HTML或使用JS,那是不可能的。 –

回答

1
<div> 
    <div> 
    <input id="myinput" /> 
    </div> 
    <div class='error'> 
    </div> 
</div> 

You can use jquery 
$("#myinput").focus(function() { 
    $(".error").hide(); 
}); 
+0

我们不需要js。只有css) – Alexander

+0

我明白,对不起。 –

-1

这可能工作:

 input:focus .error{display: none;} 
+0

对不起,它不工作 – Alexander