0

ive used a basic example from w3schools.com to get here:
https://jsfiddle.net/02wu0v49/

function myFunction() {
  var x = document.getElementById("fname").value;
  document.getElementById("demo").innerHTML = "aaaaaa";
  document.getElementById("fname").value = "bbbbb";
  alert("lala3");
}
<body>

  <p>A function is triggered when the user releases a key in the input field. The function outputs the actual key/letter that was released inside the text field.</p>

  Enter your name: <input type="text" id="fname" onkeyup="myFunction()">

  <p>My name is: <span id="demo"></span></p>
</body>

somehow the w3schools version works but it wont do anything on jsfiddle?

and it would be really nice to use [code][/code] or something to format code on stackoverflow...all those indents are terrible.

Nisal Edu
  • 7,237
  • 4
  • 28
  • 34
J. Doe
  • 80
  • 1
  • 1
  • 7

2 Answers2

4

enter image description here

Change load type to No wrap in - <body>

Here is updated fiddle

Here is Docs

Durga
  • 15,263
  • 2
  • 28
  • 52
0

If you open the browser console in JS fiddle it lists the error. The HTML can't find the JS.

Jason Allshorn
  • 1,625
  • 1
  • 18
  • 27