Deactivating parent by clicking child button?

Hello guys,
Beginners question here.
I have made a tutorial for my game.
It’s a Image (parent) with button(child) on it. When users clicks button, i want to whole Image(parent) disappear.
I have function
public void Continue(){ this.transform.parent.gameObject.SetActive (false); }

And on button i set OnClick button to call that function, but it still doesn’t work.
Can someone help me please?

Try this:

public GameObject parentObject;

public void Continue()
{
parentObject.setActive(false);
}

Assign the parent object in the inspector and also put the Continue function at the button OnClick().