2

I am new in Ionic, I just want to use JS file in one page. So I copy/paste the JS code in to the end of the .ts file, but I have different Error, It is like the .ts charge after the HTML:

Runtime Error Cannot read property 'appendChild' of null

conteneur.appendChild(image);

Runtime Error Cannot set property 'innerHTML' of null

document.getElementById('composante').innerHTML = "test";

Property 'value' does not exist on type 'HTMLElement'.

document.getElementById(tmp).value=ReponsePossibleAffichage[i];

Is there a solution to use only JS ? Or solve my problem

Thanks

Ines.bsh
  • 33
  • 6
  • 1
    The first two issues are answered [here](https://stackoverflow.com/questions/14028959/why-does-jquery-or-a-dom-method-such-as-getelementbyid-not-find-the-element). The latter just means you need to change the type information on it. It's going to be a lot easier to just cast it to the correct element than to disable type checking inside of a TS file. – Mike Cluck Oct 12 '17 at 15:29
  • Thanks I just used the window.onload = function() { }; – Ines.bsh Oct 12 '17 at 15:59

0 Answers0