How do I get a UI button to work as a child to an image?

I am making a info box for my game. It consists of an image with a text and button object as its child. I want it so when you click the button the image goes away. The problem is when I click on the button nothing happens I set the OnClick() method but when I go to the event system inspector the button doesn’t appear as hovered over or clicked at all.

@cbholmes03 Hello, I am new to unity, but I do know a few things as I am now on my second game. I think this code will help.

public GameObject Image;
then put this as its own function
public void Hide()



set the Image to that variable then put the code on an empty gameobject and then put the empty gameobject to the onclick() in the inspector then select the script and use the function hide.

Edit: made the code easier to understand.
Edit 2: made the wording easier to understand
Hope it helps