Get Input Radio Field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Radio

Introduction

The Input Radio object represents an HTML <input> element with type="radio".

You can access an <input> element with type="radio" by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

Radio Button: <input type="radio" id="myRadio">

<button onclick="myFunction()">check the radio button</button>

<script>
function myFunction() {/*  ww w  .  ja  va2 s. c om*/
    var x = document.getElementById("myRadio");
    x.checked = true;
}
</script>

</body>
</html>

Related Tutorials