Bug 48540: enable toggling same way in JS as in PHP

Change-Id: I97a42df9f5c9c2a05bcfcc64a3319301e4102377
Merge "Bug 48540: enable toggling same way in JS as in PHP"