Update javascript snippet