Search code examples
htmlplaceholder

HTML text area not displaying with placeholder


When I render the webpage, the input field displays the placeholder "enter key word" but the textarea does not display the placeholder. Where am I going wrong?

 <div>
        <textarea id="paragraph" rows="5" cols="35" placeholder="Enter the paragraph here..." value = ''>
        </textarea>
    </div>
    <div>
        <input type="text" id="word" placeholder="Enter the keyword here..." value="">
    </div>


Solution

  • Change this

    <div>
        <textarea id="paragraph" rows="5" cols="35" placeholder="Enter the paragraph here..." value = ''>
        </textarea>
    </div>
    

    to this

    <div>
        <textarea id="paragraph" rows="5" cols="35" placeholder="Enter the paragraph here..." value = ''></textarea>
    </div>
    

    The text area is taking blank spaces as values since there is space before the closing tag