Javascript 输入标记返回null
如何访问id为“createTitle”的输入。无论我尝试什么,我总是得到null而不是实际的输入Javascript 输入标记返回null,javascript,html,Javascript,Html,如何访问id为“createTitle”的输入。无论我尝试什么,我总是得到null而不是实际的输入 <!DOCTYPE html> <html> <head> </head> <body> <div id="createArticle”> <label for=‘createTitle’>Title</label> <input type=&qu
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="createArticle”>
<label for=‘createTitle’>Title</label>
<input type="text" id=“createTitle” value='title' >
<br>
<label for=“createContent”>Content</label>
<textarea type="text" id=‘createContent’></textarea>
<button onclick='createArticle()'>Create</button>
</div>
<section id='articles'>
<h1>Articles List</h1>
</section>
<script >
function createArticle(){
console.log(document.getElementById('createTitle'))
}
</script>
</body>
</body>
</html>`
不要在编程中使用卷曲引号,它们通常会破坏东西