Find closest element and connect into

Take a look here and here where it’s well explained how to retrieve the closest element\point