Added function to get the target

Added getTarget function to get the target element