js interaction with index