2
I have a button in my project, which the function is to make appear a div that is as display None, but the function is only executed from the second click on the button, the first click just selects the button. Someone would know to tell me what I’m doing wrong?
Follows prints:
Canvas:
Knob:
First click: (Selected button)
Second click: (Div appears)
Code:
HTML:
<button class="btn botaoGlobalLeft" ng-click="$ctrl.intermediacao()">
<span class="glyphicon glyphicon-menu-down"></span> Intermediação</button>
<div class="elemento form-group row" id="intermediacao">
<div class="row">
<div class="col-sm-2">
<label for="apelido2">Apelido</label>
<input type="text" title="Informe o apelido" id="apelido2" class="form-control inputEstoque">
</div>
</div>
CSS:
#informacoes{
display: none;
}
JS (Angular):
intermediacao() {
const display = document.getElementById("intermediacao").style.display;
if (display == "none") {
document.getElementById("intermediacao").style.display = 'block';
} else {
document.getElementById("intermediacao").style.display = 'none';
}
}
Please type your code in the question. Use the Code Sample option
{}
to format your code. The image of the code is very disturbing for those who answer.– gato
Edited, thanks for the tip
– guilhermedjc
It is not legal to manipulate the classes of the element directly in the code with
Angular
– Sorack
I have already withdrawn my negative vote, but to explain why I voted 'no': http://idownvotedbecau.se/imageofcode
– Jefferson Quesado
Relax, I’m new around here, and I won’t do it again
– guilhermedjc