0

I'm working on some HTML5 app with JS, and I've encountered a problem. Function written in js is working when called from console, but when clicking on button with onclick it returns a blank page.

here's the function:

function open() {
document.getElementById("chatBox").innerHTML = localStorage.chat;
return false;
}

and here's button:

<button id="openConButton" onclick="open()">Open</button>

Oh, and important one: other function from this script file are working just fine. Any ideas?

egzaell
  • 195
  • 3
  • 16

1 Answers1

3

Common pitfall; your button is calling document.open(). Just rename the function.

War10ck
  • 12,387
  • 7
  • 41
  • 54