In CSS I have a block with the display:none
property. There is a button element which changes this property to block
. Then I press the button element in the block, which was shown, but it does not display.
I tried to change other CSS properties in the line of code line that is marked with the comment //hiding
but it doesn't work either.
CSS
.optionPanel{
width: 20rem;
height: 10rem;
overflow: auto;
background: whitesmoke;
display: none;
}
JS
$(document).ready(()=>{
selectsFiling();
$('.divOption').click(function (e){
let _select = $(this).parent().parent().parent().children().get(0);
let _label = $(this).parent().parent();
let _span = _label.children().get(1);
$(_select).val(this.textContent);
let k = $('.optionPanel');
k.css('display', 'none'); //hiding
_span.textContent = this.textContent;
});
$('.fluentSelect label').click(function (e){
let _labelPanel = $(this).children(':first');
_labelPanel.css('display', 'block'); //showing
});
});
HTML
<body>
<div class="fluentSelect">
<select name="r-select" id="r-select">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<label>
<div class="optionPanel">
</div>
<span></span>
</label>
</div>
</body>