3
I have a radio button:
<input type="radio" value="1" id="monitor" style="display:none;">
Here I change the value of it, and I would like an alarm to be triggered:
$(function(){
$("#umItemQualquer").click(function(){
alert("antes da mudança " + $("#monitor").val())
$("#monitor").val(2); //Alterando valor do radio
alert("depois da mudança " + $("#monitor").val())
});
// Essa função não deveria ser ativada?
$("#monitor").change(function(){
alert("agora o bicho vai pegar!")
dispararAlarme();
});
});
According to your code, every time you change the value of the radio you will run Alert and the function will fire Larme. But what would be the purpose of this, for a radio that is hidden (display:None) on the page?
– Gustavo Carvalho
A Gambi I want to do here, rsrsrs...
– Jedaias Rodrigues
With "display:None" the change will never be triggered, as there is no way to make the element lose focus if it does not appear on the screen... ;)
– Gustavo Carvalho
@Jedaiasrodrigues has been answered your question?
– Maicon Carraro