5
Follows the code:
<select class="form-control" name="dd_medidaAplicada" id="dd_medidaAplicada">
<option value="0"></option>
<option value="cancelada">Advertência Cancelada</option>
<option value="escrita">Advertência Escrita</option>
<option value="verbal">Advertência Verbal</option>
<option value="dispensa">Dispensa por Justa Causa</option>
<option value="suspensao">Suspensão</option>
I want to run a script every time it is changed from selected item:
$("input[name=dd_medidaAplicada]").on('change', function() { alert( this.value );})
However, through the attribute name I cannot execute. If I use the attribute ID, it works! Follow example:
$("#dd_medidaAplicada").on('change', function() { alert( this.value );})
This way, Alert runs smoothly. And yes, I could use the ID attribute, but often this same problem happens in my codes and I got tired of creating an ID just to execute a code. I want to understand why not.
It worked perfectly. Thank you!
– CarlosM