added code to check if the current input element is clicked [fixes gh-3]