1

Here is the code:

<html>
<head>
    <title> Welcome Page </title>
</head>

<body>
    <h1>Greetings</h1>
    <p>
        Enter your name: <input type=“text” id=“nameBox” size=12 value="">
    </p>
    <input type="button" value="Click for Greeting"
        onclick="document.getElementById('outputDiv').innerHTML='hello' + document.getElementById('nameBox').value + ', welcome to my page.<br>Do you mind if I call you' + document.getElementById('nameBox').value + '?';">
    <hr>
    <div id=“outputDiv”></div>
</body>

All I'm getting is an error in line 13: Uncaught TypeError: Cannot read property 'value' of null.

I'm new to this, so help would be very much appreciated! Thanks.

1
  • For future reference, there's a really handy tool to find errors in your HTML: validator.w3.org Commented Sep 13, 2014 at 18:41

1 Answer 1

4
  1. You are using smart quotes in your html. Replace “” with "".
  2. size=12: 12 isn't in quotes.

Demo (Added spaces before or after some string literals to make output string easier to read.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.