<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<input type="radio" name="layerButton" value="UnTiled" id="raster" >Raster Layer
<script>
if(document.getElementById('raster').checked===true) {
alert('hi')
}
</script>
</body>
</html>I want to do something if the radio button checked. here is my js code :
if(document.getElementById('raster').checked===true) {
alert('hi')
}
and here is the HTML code:
<input type="radio" name="layerButton" value="UnTiled" id="raster" >Raster Layer
But when radio button checked nothing happened. when I write document.getElementById('raster').checked in console the out put is true but not working in my codes
Aucun commentaire:
Enregistrer un commentaire