I want to create an simple XSS. Below is my code
<body>
<script>
function update(){
const message = document.getElementById("message").value;
document.getElementById("show_message").innerHTML = message
}
</script>
<h1 class="title">Cross-Site Scripting</h1>
<div class="input">
<input type="text" id="message"/><br/>
<button type="button" onclick="update()">submit</button>
</div>
<hr/>
<div id="root">
You typed :
<span id="show_message">
</span>
</div>
</body>
Then I tried to type in <script>alert(1);</script>
.But it didn't work.
Where's the problem?