I'm new in javascript world and i know how to use if statement. But when i tried to negate the if statement of a radio button if checked, it's not working. This is my code.
<div class="form-group ">
<label class="form-control-static">Waiting location</label>
<div class="radio">
<label><input id="radio_btn" type="radio"> Location 1 </label>
</div>
</div>
<script>
if (!(document.getElementById('radio_btn').checked)) {
alert('This will pop out.');
}
</script>
i'm getting an error message of "TypeError: document.getElementById(...) is null"
Thanks in advance!