Question: ```
<!DOCTYPE html>
<html>
    <head>
        <title>Get Value form Textbox</title>
    </head>
    <body>
        <form>
            First Name:<input type="text" id="firstname" value="firstname"> Last Name:<input type="text" id="lastname" value="lastname">

```

This is the script which I believe to be causing problems, I am unsure if this is the correct method to use to get the value of the textbox

```
            <script>
                var first_name = document.getElementById("firstname");
                var last_name = document.getElementById("lastname");
            </script>

            <p></p>
            <input type="submit" value="Submit" onclick="my_checker(first_name, last_name);">
        </form>
        <script>
            function my_checker(fName, lName)
            {
                alert("Hello " + fname + " " + lname);
            }
        </script>
    </body>
</html>

```

Answer: 
I think this is what you want.

```js
function my_checker(){
      var fname = document.getElementById("firstname").value;
      var lname = document.getElementById("lastname").value;
      alert("Hello " + fname + " " + lname);
}
```

```html
    <head>
        <title>Get Value form Textbox</title>
    </head>
    <body>
        <form>
            First Name:<input type="text" id="firstname" value="firstname"> Last Name:<input type="text" id="lastname" value="lastname">
              <p></p>
            <input type="submit" value="Submit" onclick="my_checker();">
        </form>
```
Below is how you would structure it. 

Note that you should use eventListeners instead of inline javascript - and always separate your js from the html... You don't put scripts randomly in your html markup.

```html
<!DOCTYPE html>
<html>
    <head>
        <title>Get Value form Textbox</title>
    </head>
    <body>
        <form>
            First Name:<input type="text" id="firstname" value="firstname"> 
            Last Name:<input type="text" id="lastname" value="lastname">
            <p></p>
            <input type="submit" value="Submit" id="submitBtn">
        </form>
        <script>            
            document.getElementById('submitBtn').addEventListener('click', function(e) {
              e.preventDefault(); // important to stop the form from actually submitting.
              var fname = document.getElementById("firstname").value;
              var lname = document.getElementById("lastname").value;
              alert("Hello " + fname + " " + lname);
            });    
        </script>
    </body>
</html>
```