This is my code and I want to get value of myText. I tried with appendChild but it doesn't work. How can I get myText value when I click on button?
<div class="tut">
<input type="text" name="" id="myText" style="padding: 2px; font-size: 18px; outline: none;">
<input type="submit" name="" id="myBtn" onclick="myFunc()" style="padding: 2px; font-size: 18px;">
<ul id="myList">
<li>Coffe</li>
<li>Tea</li>
</ul>
<script type="text/javascript">
function myFunc() {
var = document.getElementById("myText").value;
document.getElementById("myList").appendChild();
}
</script>
</div>`