How to I get an object to disappear when I use the mouse to click on it?

I have this coding…

function Update () { if (Input.GetButtonDown ("Fire1")) { transform.position = Vector3(Input.mousePosition.x, 0, Input.mousePosition.y); } }

This makes the object disappear but if I click anywhere on the scene it disappears. I want to restrict it so it only disappears when I click on the object.

Add a script with the following code to the object you want to go-away when clicked:

function OnMouseDown () {
  gameObject.active = false; //hide
  //Destroy(gameObject); //delete
}