-1

I want to replace the word null with the word REPLACED in my chrome extension popup

My HTML

<!DOCTYPE html>

<html>
  <head>
    <script src="popup.js" type="text/javascript"></script>
  </head>

  <body>
    <h1> Wordnik Lookup </h1>
    <p id = "userselect">null</p>

  </body>
</html>

My popup.js:

document.getElementyById("userselect").innerHTML = "REPLACED!";

The error message I get from inspecting the popup

Uncaught TypeError: document.getElementyById is not a function

Any help on this would be greatly appreciated :)

igohardinmath
  • 43
  • 1
  • 5
  • 3
    you have `getElementyById` (the extra y between the t and the B) instead of `getElementById` – Kurt May 17 '18 at 17:07

1 Answers1

0

There is two kind of error. One is typo (spelling mistake). Another is including JavaScript position.

<html>
  <head>

  </head>

  <body>
    <h1> Wordnik Lookup </h1>
    <p id = "userselect">null</p>

     <!--- Kep JavaScript at end. Otherwise listen for DOMContentloaded event --->
     <script src="popup.js" type="text/javascript"></script>
  </body>
</html>

Inside of popup.js

document.getElementById("userselect").innerHTML = "REPLACED!";

Ritwick Dey
  • 18,464
  • 3
  • 24
  • 37