به دلائل زیادی بهتر هست که بجای آوردن eventها بعنوان attribute المان (مثل همین onclick)
از addEventListener استفاده کنین:

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>barnamenevis 591830</title>
<script>
document.addEventListener('DOMContentLoaded', () => {
const combo = document.querySelector("#opCreate");
const textbox = document.querySelector("#valC");
const button = document.querySelector("#btn");
const div=document.querySelector("#content");

btn.addEventListener('click', () => {
const elem = document.createElement(combo.value);
const textnode = document.createTextNode(textbox.value);
elem.appendChild(textnode);
div.appendChild(elem);
});
});
</script>
</head>

<body>
<select id="opCreate">
<option value="p">paragraph</option>
<option value="h1">header 1</option>
<option value="a">anchor</option>
<option value="span">span</option>
</select>
<input type="text" id="valC">
<button type="button" id="btn">ایجاد</button>
<div id="content"></div>
</body>

</html>


اینجا از رخداد DOMContentLoaded داکیومنت استفاده کردیم
که در اون مطمئن هستیم همه dom رندر شده و در دسترس هست،
و در این رخداد برای button یک eventlistener برای click تعریف کردیم.