Ahmed Elshorbagy Ahmed Elshorbagy - 1 year ago 94
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

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download