Fix DOM manipulation to avoid deprecated functions in Sudoku solver example.
This commit is contained in:
15
README.md
15
README.md
@@ -266,17 +266,24 @@ Then a `pkg` directory will be created, containing everything you need for a web
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Output results
|
// Output results
|
||||||
document.write(`<p>Sudoku solver returns:</p>`);
|
const solutionDiv = document.querySelector("#soduku-solution");
|
||||||
for (const solution of formattedSolutions) {
|
for (const solution of formattedSolutions) {
|
||||||
document.write(`<pre>${solution}</pre>`);
|
const newPre = document.createElement("pre");
|
||||||
|
newPre.textContent = solution;
|
||||||
|
solutionDiv.appendChild(newPre);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body></body>
|
<body>
|
||||||
|
<p>Sudoku solver returns:</p>
|
||||||
|
<div id="soduku-solution">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Then you can serve it with your favorite http server like `python -m http.server` or `npx serve`, and access the page with your browser.
|
Then you can serve it with your favorite http server like `python -m http.server` or `npx serve`, and access the page with your browser.
|
||||||
|
|||||||
Reference in New Issue
Block a user