How to you call a if function in this scernio?

I had a peace of code:

<head>
<meta charset=“utf-8”>
<title>The Elements Search</title>
<style type=“text/css”>

</style>
</head>

<body>

<div id=“searchbar-frame”>
<div id=“container-1”>
<span id=“icon”><i class=“fa fa-search”></i></span>
<input type=“search” id=“search” placeholder=“Search Elements…” />
</div>
</div>

<script>
if document.getElementById()

</script>

</body>
</html>

In the script, I was trying to call the text in the search bar into the data pit. I wasn’t going to do it with XML, PHP, or SQL. All I want to know is how do I call the user text in a “if” statement.

Assuming you want to do something with the text on the client side using Javascript, you would do something like this:
<script type=“text/javascript”>
if (document.getElementById(“search”).value == <whatever you are looking for>)
{
<do something>
}
else
{
<do something else>
}

</script>

Is that what you were thinking about? If not, what are you trying to accomplish?