Corrected js for call back to hide irrelevant elements