Skip to main content
HTML Validation

Bad value X for attribute “value” on element “input”: Line feed not allowed.

About This HTML Issue

A single-line <input>, such as type="text", can't hold a line break in its value, so the text has to fit on one line or move to a <textarea>.

The HTML standard says the value of text, search, telephone and password inputs must not contain line feed or carriage return characters. Browsers enforce this by stripping them: an input whose value is 12 Main Street, a line break and Springfield shows 12 Main StreetSpringfield, with the two lines glued together. Writing the line break as &#10; doesn't help, because the validator and the browser both see the decoded character.

This usually happens when a template prints text from a database or a rich text editor straight into value, and that text was saved with line breaks. When Nu shortens a long value, the message reads Bad value for attribute, with no value between the two spaces; look for an <input> whose value spans several lines in the source.

Pick the fix that matches what the field is for:

  • If people should see and edit several lines, use a <textarea>, which keeps line breaks.
  • If the field is meant to be single-line, replace the line breaks with a space or a comma before printing the value.
  • If the input only carries data for a script and nobody edits it, type="hidden" accepts line breaks in its value.

Invalid example

<label for="address">Address</label>
<input type="text" id="address" name="address" value="12 Main Street
Springfield">

Valid example

<label for="address">Address</label>
<input type="text" id="address" name="address" value="12 Main Street, Springfield">

Keeping the line break with a textarea

<label for="address">Address</label>
<textarea id="address" name="address" rows="2">12 Main Street
Springfield</textarea>

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries