1
Hello,
I made a branch filter for my company, but I put up a backlog.
I want the person to choose the region of the subsidiary and browse the content of that button and that the content will disappear if she presses the same button or chooses another region.
Current HTML code:
<form style="display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;">
<input id="button"type="button" class="cb" value="Sul" name="1" id="1" onclick="itemSelectS(this)" onblur="showDivAttidS(this)"/>
<input id="button"type="button" class="cb" value="Sudeste" name="2" id="2" onclick="itemSelectSE(this)" onblur="showDivAttidSE(this)"/>
<input id="button"type="button" class="cb" value="Centro - Oeste" name="3" id="3" onclick="itemSelectCO(this)" onblur="showDivAttidCO(this)"/>
<input id="button"type="button" class="cb" value="Norte / Nordeste" name="4" id="4" onclick="itemSelectNEN(this)" onblur="showDivAttidNEN(this)"/>
</form>
<div style="display:none" id="1">Nenhuma filial cadastrada!</div>
<div style="display:none" id="2">Nenhuma filial cadastrada!</div>
<div style="display:none" id="3">Nenhuma filial cadastrada!</div>
<div style="display:none" id="4">Nenhuma filial cadastrada!</div>
<script src="main.js"></script>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
CSS:
#button {
background-color:rgba(110, 74, 74, 0.103);
border-color: #415f78 ;
border-width: 3px;
width: 450px;
height: 50px;
border-radius: 5px;
}
#button[value]{
color: #415f78;
}
#button:hover{
background-color: #415f78;
border-color: forestgreen;
-webkit-transition-delay: 0.1s;
-moz-transition: .1s all;
-moz-transition-delay: 0.1s;
-ms-transition: .1s all;
-ms-transition-delay: 0.1s;
-o-transition: .1s all;
-o-transition-delay: 0.1s;
transition: .1s all;
transition-delay: 0.1s;
}
#button[value]:hover{
color: white;
-webkit-transition-delay: 0.1s;
-moz-transition: .1s all;
-moz-transition-delay: 0.1s;
-ms-transition: .1s all;
-ms-transition-delay: 0.1s;
-o-transition: .1s all;
-o-transition-delay: 0.1s;
transition: .1s all;
transition-delay: 0.1s;
}
JS:
function itemSelectS() {
document.getElementById('1').style.display = "block";
}
function itemSelectSE() {
document.getElementById('2').style.display = "block";
}
function itemSelectCO() {
document.getElementById('3').style.display = "block";
}
function itemSelectNEN() {
document.getElementById('4').style.display = "block";
}
function showDivAttidS(){
document.getElementById("1").style.display = 'none';
}
function showDivAttidSE(){
document.getElementById("2").style.display = 'none';
}
function showDivAttidCO(){
document.getElementById("3").style.display = 'none';
}
function showDivAttidNEN(){
document.getElementById("4").style.display = 'none';
}
The way it is, in case I click on any link, or anything of the content, it disappears as if it had closed, due to onblur.I’ve looked for people who’ve been through something like this but I haven’t found the solution.