add JS in function & changes in index