0
The code below only gives the first radio input someone knows how to fix it so he recognizes at least one radio input marked
$(document).ready(function(){
$(document).on('click','#teste',function(){
if($('#area').is(":checked"))
{
alert('marcado');
}
else
{
alert('n marcado');
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="radio" name="area" id="area" value="vl1">
<input type="radio" name="area" id="area" value="vl2">
<input type="radio" name="area" id="area" value="vl3">
<input type="radio" name="area" id="area" value="vl4">
<button id="teste">TESTE</button>
The attribute
id
sets a single element on the page, so only the first one works. It makes no sense for you to assign the same value toid
for various elements on the page.– Woss