2 ms·
A somewhat apples-to-oranges comparison I know but; 277B: <!DOCTYPE html> <html lang="en"> <head> <title>Test</title> </head> <body
by Zelphyr 7y ago
A somewhat apples-to-oranges comparison I know but; 277B:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test</title>
</head>
<body>
<div id="howdy"></div>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', () => document.getElementById('howdy').innerHTML = 'Hello world!')
</script>
</body>
</html>
- lioeters 7y agoOmitting html, head, and body tags is allowed by HTML specs, and the script tag's default type is "text/javascript". So it could be further simplified to: <title>Test</title> <div id="howdy"></div> <script> document.addEventListener('DOMContentLoaded', () => document.getElementById('howdy').innerHTML = 'Hello world!' ) </script> Edit: formatting