Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. What is the mistake ??

What is the mistake ??

Scheduled Pinned Locked Moved JavaScript
javascriptquestionlearninghtmltools
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Joe Rozario
    wrote on last edited by
    #1

    Hi all, i am beginner and learning. below my sample code. demo is working and demo1 is not , what the mistake i have done

    <!DOCTYPE html>
    <html>
    <body>

    <h1>My First JavaScript</h1>

    <p id="demo1">
    what the hell is going on.
    </p>
    <p id="demo">
    JavaScript can react to events. Like the click of a button.
    </p>

    <script>
    function myFunction()
    {
    document.getElementById("demo").innerHTML="Hello JavaScript!";
    doucment.getElementById("demo1").innerHTML="This is not working";
    }
    </script>

    <button type="button" onclick="myFunction()">Click Me!</button>

    </body>
    </html>

    Thanks Joe

    G J S D 4 Replies Last reply
    0
    • J Joe Rozario

      Hi all, i am beginner and learning. below my sample code. demo is working and demo1 is not , what the mistake i have done

      <!DOCTYPE html>
      <html>
      <body>

      <h1>My First JavaScript</h1>

      <p id="demo1">
      what the hell is going on.
      </p>
      <p id="demo">
      JavaScript can react to events. Like the click of a button.
      </p>

      <script>
      function myFunction()
      {
      document.getElementById("demo").innerHTML="Hello JavaScript!";
      doucment.getElementById("demo1").innerHTML="This is not working";
      }
      </script>

      <button type="button" onclick="myFunction()">Click Me!</button>

      </body>
      </html>

      Thanks Joe

      G Offline
      G Offline
      Graham Breach
      wrote on last edited by
      #2

      You misspelled "document" as "doucment" on the "demo1" line. If you look in the Javascript console, there should be an error message saying something like "doucment is not defined" - when something in JS fails to work, you should look there first.

      1 Reply Last reply
      0
      • J Joe Rozario

        Hi all, i am beginner and learning. below my sample code. demo is working and demo1 is not , what the mistake i have done

        <!DOCTYPE html>
        <html>
        <body>

        <h1>My First JavaScript</h1>

        <p id="demo1">
        what the hell is going on.
        </p>
        <p id="demo">
        JavaScript can react to events. Like the click of a button.
        </p>

        <script>
        function myFunction()
        {
        document.getElementById("demo").innerHTML="Hello JavaScript!";
        doucment.getElementById("demo1").innerHTML="This is not working";
        }
        </script>

        <button type="button" onclick="myFunction()">Click Me!</button>

        </body>
        </html>

        Thanks Joe

        J Offline
        J Offline
        jsampathkumar
        wrote on last edited by
        #3

        Hello Joe, spelling mistake in second statement. document Regards, J Sampath Kumar, Osmosys

        1 Reply Last reply
        0
        • J Joe Rozario

          Hi all, i am beginner and learning. below my sample code. demo is working and demo1 is not , what the mistake i have done

          <!DOCTYPE html>
          <html>
          <body>

          <h1>My First JavaScript</h1>

          <p id="demo1">
          what the hell is going on.
          </p>
          <p id="demo">
          JavaScript can react to events. Like the click of a button.
          </p>

          <script>
          function myFunction()
          {
          document.getElementById("demo").innerHTML="Hello JavaScript!";
          doucment.getElementById("demo1").innerHTML="This is not working";
          }
          </script>

          <button type="button" onclick="myFunction()">Click Me!</button>

          </body>
          </html>

          Thanks Joe

          S Offline
          S Offline
          Santosh K Tripathi
          wrote on last edited by
          #4

          <!DOCTYPE html>
          <html>
          <body>

          <h1>My First JavaScript</h1>

          <p id="demo1">
          what the hell is going on.
          </p>
          <p id="demo">
          JavaScript can react to events. Like the click of a button.
          </p>

          <script>
          function myFunction()
          {
          document.getElementById("demo").innerHTML="Hello JavaScript!";
          document.getElementById("demo1").innerHTML="This is not working";
          }
          </script>

          <button type="button" onclick="myFunction()">Click Me!</button>

          </body>
          </html>

          Try this... there is miss Sppell in document

          1 Reply Last reply
          0
          • J Joe Rozario

            Hi all, i am beginner and learning. below my sample code. demo is working and demo1 is not , what the mistake i have done

            <!DOCTYPE html>
            <html>
            <body>

            <h1>My First JavaScript</h1>

            <p id="demo1">
            what the hell is going on.
            </p>
            <p id="demo">
            JavaScript can react to events. Like the click of a button.
            </p>

            <script>
            function myFunction()
            {
            document.getElementById("demo").innerHTML="Hello JavaScript!";
            doucment.getElementById("demo1").innerHTML="This is not working";
            }
            </script>

            <button type="button" onclick="myFunction()">Click Me!</button>

            </body>
            </html>

            Thanks Joe

            D Offline
            D Offline
            Dholakiya Ankit
            wrote on last edited by
            #5

            <script>
            function myFunction()
            {
            document.getElementById("demo").innerHTML="Hello JavaScript!";
            document.getElementById("demo1").innerHTML="This is not working";
            }
            </script>

            spelling mistake

            ajd

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups