adding js to detect click