Controlling input from JS