List selected checkbox

Asked

Viewed 30 times

0

I have a question regarding a function, how do I present the selected values of the checkbox and combobox in real time? For example, if I select option 1 of the combobox and a checkbox option the two appear in list format.

Ex:

List Option 01 - Combobox Option 01 - Checkbox

1 answer

0

You can do this using Javascript. Create a function that will be executed whenever you change the value, in the function you can write to the console using console.log() or put in an Alert() or still write to html $("#div"). innerHtml(). It would look something similar to this:

<script> $(document).ready(function(){ $('#combo').on('change', function (e) { var opcaoSelecionada = $("option:selected", this); var valueSelected = this.value; alert(valueSelected); }); }); </script>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.