Good day. Created an empty Cordova project and connected jQuery Mobile. When I just prescribe document.getElementById('area').innerHTML = "Hello"; in the emulator, it shows Hello , but when I want to do this in a function, so that when I press the button, this message is highlighted, nothing happens.

 function show() { document.getElementById('area').innerHTML = "Hello"; } <input type="button" value="Показать" onclick="show()" /> 

I work in Visual Studio 2015 and emulate it via Ripple - Nexus (Galaxy). What could be the problem?

  • How about showing how you are doing through a function ? - Vladyslav Matviienko
  • The problem is somewhere in your code. - Darth

2 answers 2

Solved the problem in this way:

 document.getElementById('show-area').addEventListener('click', function () { document.getElementById('area').innerHTML = "Hello"; }) <input type="button" value="Показать" id="show-area" /> 

    Why doesn't it work? Everything works great

    https://jsfiddle.net/zzaopw77/

     <div id="area"></div> <input type="button" value="Показать" onclick="show()" /> function show() { document.getElementById('area').innerHTML = "Hello"; }