How to show and hide placeholder text

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

Answers 1
  • 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!'"/>
    
    0

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

  • Back to code snippet queries related javascript