Ahmed Elshorbagy Ahmed Elshorbagy - 3 months ago 6x
Javascript Question

dropdown hide image onchange javascript

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


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.