0

I'm writing Android app (single page application), using Visual Studio tools for Cordova and Ratchet bootstrap. After injecting new HTML into page, my </div> tag mysteriously transformed to </button>, and markup crashed.

Example of injected HTML:

<div class="content">
<button class="btn btn-negative btn-block" onclick="Logout();>Logout</button>
<div class="heartbeat"></div>
</div>

Injecting code:

$('body').html(finalHtml);
$('#heartbeat').html('');

What it turned to:

<div class="content">
<button class="btn btn-negative btn-block" onclick="Logout();>Logout</button>
<div class=" heartbeat"=""></button>
</div>

Where should I seek a reason? It's a Ratchet bug? Or Cordova? I'm completely out of mind :(

Vasilij
  • 468
  • 6
  • 20

1 Answers1

1
onclick="Logout();

you are missing " there at least. After that it seems to work correctly at least on JSFiddle.

Roope Hakulinen
  • 7,326
  • 4
  • 43
  • 66
  • As usual :))) Hundreds of log messages, great error processing, and such stupid error. Thanks!! – Vasilij Dec 17 '14 at 07:58
  • To prevent this kind of unnecessary errors, consider using tools that color code and check the syntax all the time for HTML, JS and CSS. One great (but unfortunately not free) tool is IntelliJ IDEA which is superb for Cordova development for me. – Roope Hakulinen Dec 17 '14 at 08:00