Change placeholder text

How can I change the placeholder text of an input element?

For example I have 3 inputs of type text.

  • Get input value from HTML5 input[type=“date”] in chrome
  • Showing Android's soft keyboard when a field is .focus()'d using javascript
  • Disable select, allow copy/paste
  • html5: is there a way to prevent children interfering with drag events
  • Replacement for chrome.Port prototype
  • HTML5 Cross-domain XmlHttpRequest vs. Older XmlHttpRequests
  • <input type="text" name="Email" placeholder="Some Text">
    <input type="text" name="First Name" placeholder="Some Text">
    <input type="text" name="Last Name"placeholder="Some Text">

    How can I change the Some Text text using JavaScript or jQuery? I really need to to figure this out to solve my problem.

  • Setting innerHTML of HTML progress bar
  • Extract part of video with html5 video. Fullscreen issues on iphone/ipad
  • Streaming CZML into Cesium using HTML5 EventSource
  • Simple JavaScript login form validation
  • Crop local image file
  • Fix centering last line of elements in fluid container grid to be left aligned while container stays centered
  • 6 Solutions collect form web for “Change placeholder text”

    you can use getElementsByName() method to select the input fields and to change the placeholder for each one… see the below code…

    document.getElementsByName('Email')[0].placeholder='new text for email';
    document.getElementsByName('First Name')[0].placeholder='new text for fname';
    document.getElementsByName('Last Name')[0].placeholder='new text for lname';

    If you want to use same placeholder text for all text inputs, you can use

    $('input').attr('placeholder','Some New Text');

    And if you want different placeholders, you can use the element’s id to change placeholder

    $('#element1_id').attr('placeholder','Some New Text 1');
    $('#element2_id').attr('placeholder','Some New Text 2');

    Using jquery you can do this by following code:

    <input type="text" id="tbxEmail" name="Email" placeholder="Some Text"/>
    $('#tbxEmail').attr('placeholder','Some New Text');

    I have been facing the same problem.

    In JS, first you have to clear the textbox of the text input. Otherwise the placeholder text won’t show.

    Here’s my solution.

    document.getElementsByName("email")[0].placeholder="your message";
    var input = document.getElementById ("IdofInput");
    input.placeholder = "No need to fill this field";

    You can find out more about placeholder here:

    Try accessing the placeholder attribute of the input and change its value like following.
    $(‘#some_input_id’).attr(‘placeholder’,’New Text Here’);
    Can also clear the placeholder if required like..