placing the js snippet to the right place