Hi Team,


I'm trying to use JavaScript in mobile application, with a simple statement as document.getElementById("Containername").style.display = "none";

but when i run this script it is showing error as " Cannot read property "style" of null".

Please help me how to fix this issue.


Thanks in advance, 

Ekadeep.K


Hi Kuruma,

First thing I notice here is that you just use the Containername as the id.

You should try run the script like this:

document.getElementById('"+YourContainerName.Id+"'').style.display = 'none';

Kind regards,

Jimmy

Yes, Jimmy is right: Id's of elements are auto-generated by the Platform, and should always be queried via the "Id" Runtime Property of the Widget.

Also in mobile javascript can have input parameters (I wish web had this aswell....) so you can do stuff like:

document.getElementById($parameters.MyContainer).style.display = 'none';