2
I have a CSS that shows and hides a div
.
But I want this to happen only if this field below is filled, that is, if it is different from empty.
<input type="text" onkeypress="return BuscaDados(event);" onblur="CarregaFornecedor(this.value);" class="form-control" name="FornecedorID" id="idfornecedor" />
He shows this div
:
<div class="col-md-5 div_teste" id="mostrar">
<div class="col-md-12">
<label class="control-label" id="fornecedor"></label>
</div>
<div class="col-md-12">
<label class="control-label" id="nomefornecedor"></label>
</div>
<div class="col-md-12">
<label class="control-label" id="ruafornecedor"></label>
<label class="control-label" id="nfornecedor"></label>
</div>
<div class="col-md-12">
<label class="control-label" id="bairrofornecedor"></label>
<label class="control-label" id="cidadefornecedor"></label>
</div>
</div>
This is the CSS:
#mostrar {
display: none;
}
#passarmouse:hover #mostrar {
display: block;
}
.div_teste {
width: 350px;
height: 120px;
background: #ffffff;
position: absolute;
z-index: 100;
top: 30%;
left: 40%;
border: 1px solid;
}
Use Javascript to validate and change the state of the element.
– João Pedro Schmitz
Only with CSS is impossible. HTML -> Structuring; CSS ->
Estilização
; JS -> Demeanor.– LeAndrade
Mariana gave a solution only with CSS if you have any questions can give me a touch of the answer I try to help you.
– hugocsl