js로 html 태그 만들기
Make a html tag using js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>끝말잇기</title>
</head>
<body>
<!--<div>Heunna</div>-->
<input type="text" />
<button>등록</button>
<script src="끝말잇기.js"></script>
</body>
</html>var body = document.body;
var word = document.createElement('div');//태그를 새로 만들었으면 반드시 append로 추가해줘야한다!
word.textContent = 'Heunna'
document.body.append(word);
var prompt = document.createElement('input');
document.body.append(prompt);
var btn = document.createElement('button');
btn.textContent = '입력';//태그 안에 들어가는 글자.
document.body.append(btn);
var result = document.createElement('div');
document.body.append();Last updated