2

I'm creating a mobile application on monaca.io. I try to hide image when user select an option from combobox but nothing happens.

function setImageVisible(id, visible) {
    var img = document.getElementById(id);
    img.style.visibility = (visible ? 'visible' : 'hidden');
}

Thank you

Alessio
  • 3,404
  • 19
  • 35
  • 48
Ahmed Elshorbagy
  • 350
  • 1
  • 5
  • 16
  • 2
    do you get your img element or are you already stuck there? – Luca Aug 07 '15 at 14:11
  • the code works on Chrome, but when I try it on monaca emulator the code is not working. I have the img element on my html5 document and I just want to hide and put some other code. – Ahmed Elshorbagy Aug 07 '15 at 16:13

1 Answers1

0

This code looks ok. As you states in your comment that it's working on chrome, I think this is not working because of some issue in the monaca emulator.

I'd suggest you try to debug your Code that you can check here:

var img = document.getElementById(id);

If your var img successfully gets the image.

Luca
  • 1,766
  • 3
  • 27
  • 38