I have a domain name with a CPanel. I was trying to make a search feature where a javascript string will join with an input HTML tag which is stored in a variable using document.getElementById(). There is also a button with onlick event <button id="btn-js" onclick="location.href=text_2">Search</button>
where text_2 is the combination of the website URL string and the input id. But when I run it, it goes to my website URL but on an error page. I have tried to add it after the onclick event but It doesn't work.
Full Code:
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta name="author" content="PoopyPooper">
<link rel="stylesheet" href="index.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="icon" href="http://img.asdfghjklzxcvbnm.ml/icons/mainIcon.png">
<meta charset="utf-8">
<meta name="description" content="The place where we store images, icons and many more media for easy use.">
<title>The place where we add media!!</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
var search_feature_text1 = 'http://media.asdfghjklzxcvbnm.ml/';
var lol = document.getElementById("id") //LOL
var text_2 = search_feature_text1+lol;
</script>
</head>
<body>
<p class="head">MEDIA!!</p><br><br><br>
<p class="body-1">Type the url on your web or just type in the image directory(All the text with slashes (if there
are) After media.asdfghjklzxcvbnm.ml/)
here: <br></p>
<p class="content-change">http://media.asddfghjklzxcvbnm.ml/<input type="text" id="id" placeholder="Your directory here">
<button id="btn-js" onclick="location.href=text_2">Search</button></p>
</body>
</html>