How to show and hide placeholder text

Updated at 22-Nov-2021, By samar

How to show and hide placeholder text

In this session, we are going to try to solve the "How to show and hide placeholder text" puzzle by using the computer language.

You can show and hide placeholder text onfocus and onblue event on input element.
  • Hide placeholder text on focus input element

    <input type="text" placeholder="Please validate your access code!" onfocus="this.placeholder = ''" 
    onblur="this.placeholder = 'Please validate your access code!'"/>
    

    You can show and hide input placeholder text using onfocus and onblur event.

Back to code snippet queries related javascript