I'm developing a Laravel application, and trying to create a modal to fill a table. I've added a eventListener
to a select inside the modal. When I change the value of the select and it triggers the eventListener
, the console show the error below:
[Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
I've tried many other ways to avoid this, but nothing worked. The code is below(don't know why, but the snippet isn't working). Can somebody wonder why this is happening?
function addFuncionalidade() {
console.log('updated')
const value = $("#select-funcionalidade").val()
console.log(value)
$('#nome-funcionalidade').val(value)
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.3/semantic.min.css"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.3/semantic.min.js"></script>
<div class="ui centered container">
<button class="ui labeled icon button" onclick="$('#nova-funcionalidade').modal('show')">
<i class="plus icon"></i>
Acrescentar funcionalidade
</button>
</div>
<div id="nova-funcionalidade" class="ui tiny modal">
<div class="header">
Inserir funcionalidade
</div>
<div class="centered scrolling content ui form">
<div class="ui field">
<label>Tipo</label>
<select id="select-funcionalidade" onselect="addFuncionalidade()">
<option value=1>Test 1</option>
<option value=2>Test 2</option>
</select>
</div>
<div class="ui field focus">
<label>Nome</label>
<input id="nome-funcionalidade" placeholder="Nome da funcionalidade"/>
</div>
<div class="ui field">
<label>Descrição</label>
<textarea id="descricao-funcionalidade" rows=3></textarea>
</div>
<div class="actions">
<button class="ui cancel button" onclick="$('#nova-funcionalidade').modal('hide')">Fechar</button>
</div>
</div>
</div>