I have simple HTML code with some javascript, it looks like:
<html> <head> <script type="text/javascript"> function changeDivContent() { // ... }; </script> </head> <body> <input type="radio" name="radiobutton" value="A" onClick="changeDivContent()"> <input type="radio" name="radiobutton" value="B" onClick="changeDivContent()"> <div id="content"></div> </body> </html>
Assuming you're not using jQuery or some other library that makes this sort of thing easier for you, you can just use the element's innerHTML property.
document.getElementById("content").innerHTML = "whatever";
1.4m articles
1.4m replys
5 comments
56.9k users