How to I press a button once to display text and again to remove it?

My code is displaying voltage and I want to have a button that when pressed it displays a text and when I pressed it again it would turn off the text.

Here’s my code:

float vPow = 4.7; 
float r1 = 1000000; 
float r2 = 100000;
const int buttonPin = 8;
int buttonState = 0;



#include <LiquidCrystal.h> 
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);


void setup() {
    
   lcd.begin(16, 2);

  pinMode(buttonPin, INPUT);
   
   Serial.begin(100);


   
    }

void loop() { 
    float v = (analogRead(0) * vPow) / 1024.0; 
    float v2 = (v / (r2 / (r1 + r2)))/.48;


    
    lcd.setCursor(0,0);
    lcd.print("V:");Serial.println(v2); lcd.print(v2); lcd.print("%");delay(100);
    buttonState = digitalRead(buttonPin);

  

  
    if (buttonState == HIGH) {
    // turn LED on:
    lcd.setCursor(0,1); lcd.print("YES");
  } else {
     lcd.setCursor(0,1); lcd.print("");
  }

}

Look at the StateChangeDetection example in the IDE.
Detect the change of state of the input, set a boolean variable to true when the button is first pressed, false when next pressed, true when next pressed and so on. Put your display code inside an if statement code block and only execute it when the boolean variable is true.

lcd.print("") wont give you what you want, you need to send actual SPACE characters to clear the existing text

e.g. lcd.print(" ");

(add more space characters if you must)

UKHeliBob:
Look at the StateChangeDetection example in the IDE.
set a boolean variable to true when the button is first pressed, false when next pressed, true when next pressed

How would I do the false when next pressed?

GGMist:
How would I do the false when next pressed?

Invert the value of the boolean variable each time a button press is detected,

showTheText = !showTheText;