My question is related to this question:
What does the + sign mean in CSS?
I'm using the + sign to make an effect on a form that I have.
It works, but the question is that my form has validation. That is, when I click the button to submit the form information a label.error
is added to the code, with the error message.
Hence the effect on the field is lost because ul.opcoes
is no longer the next field when label.error
appears.
.select-area-field:focus + ul.opcoes{
visibility: visible;
}
So my question is:
- How to make CSS find a specific element in the tree following these rules?
HTML
<div class="inline select-area">
<input type="text" name="area" placeholder="Área Desejada" readonly="readonly" class="select-area-field"/>
<!-- A Label aparece bem aqui -->
<ul class="opcoes">
@foreach($area as $item)
<li data-id="{!! $item->id !!}">{!! $item->area !!}</li>
@endforeach
</ul>
<input type="hidden" name="cod-area" id="cod-area" />
</div>
jQuery is usually done like this:
$(document).find('div.wrapper');