Radio Button Check
I am trying to check if a radio box is checked using JavaScript, but I
can't seem to figure it out properly.
This is the HTML code:
<input type="radio" name="status" id="employed_yes" value="yes">
<input type="radio" name="status" id="employed_no" value="no">
I have tried using jQuery as follows:
$(document).ready(function() {
if($('#employed_yes').is(':checked')) {
// do something
}
});
Also, I tried using pure Javascript by getting the element and check its
'checked' attribute, but it didn't work.
I look forward to your insight!
Thank you!
No comments:
Post a Comment