4
My question relates to this question:
I’m using the + sign to do an effect on a form I have.
It works, but the point is that my form has validation. That is, when I click the button to submit the form information a label.error
, with the error message.
Hence the effect on the field is lost because the ul.opcoes
is no longer the next field when appears the label.error
.
.select-area-field:focus + ul.opcoes{
visibility: visible;
}
So my question is:
- How to make CSS find a specific element in the tree by 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>
With jQuery if it used to do so:
$(document).find('div.wrapper');
I actually have control over the position of
label.error
. I can throw everything into a container. I just did that and it worked. But what I asked is already possible with CSS ?– Diego Souza
I don’t know if that’s the best title for that question. : thinking:
– Diego Souza
The title is really bad, when reading the title I thought you wanted a CSS selector for this:
<span>+</span>
(an element with the contents of a "+"). Hehe. I’m not sure how to improve, but the "+" command in the CSS selector is given this technical name: Adjacent sibling selectors, Maybe this can help you. = D– Fernando Leal