I can't get the value of selected Id.
Here's the html and javascript
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<input id="input">
<button id="button" type="button" name="button">Search</button>
<script>
const der = document.getElementById('input').value;
document.getElementById('button').addEventListener('click',
function() {
alert(der);
});
</script>
</body>
</html>
I tested it on chrome, opera, and firefox. Nothing work. I have used varalso instead of const, that dont work too.
I want to get the input value of the Id I selected. I really can't see any problem in the code
deris an empty string. Try evaluatingdocument.getElementById('input').valuewithin your click listener function :)