Changing properties of a div with a click

0

I have the following html:

<div id="personalizada">
    <i class="fa fa-plus" aria-hidden="true"></i>
</div>
<div class="balao"></div>

I would like when I click id="custom" the opacity of id="balloon" change to 1.

    
asked by anonymous 12.01.2017 / 01:29

1 answer

2

Would that be it?

function mudaOpacidade() {
  document.getElementsByClassName("balao")[0].style.opacity=1;
}
.balao {
  height: 120px;
  width: 120px;
  background-color: #0f0;
  opacity: 0;
}
<div id="personalizada" onclick="mudaOpacidade()">
  Cliqyaqui
  <i class="fa fa-plus" aria-hidden="true"></i>
</div>
<div class="balao"></div>

With jquery it would be:

$("#personalizada").on("click",function(){
$(".balao").css("opacity",1);
});
.balao {
  height: 120px;
  width: 120px;
  background-color: #0f0;
  opacity: 0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divid="personalizada">
  Clique aqui
  <i class="fa fa-plus" aria-hidden="true"></i>
</div>
<div class="balao"></div>
    
12.01.2017 / 01:44