Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

input content value is not showing on front end

I have this code that I receive from database a formated data of a social security number.

<div class="col-md-3">
  <h5>Social Security #:<span class="text-danger">*</span></h5>
  <div class="controls">
    <div id="show-create">
      <input type="number" id="social-security" name="social-security" class="form-control" value="123-45-6789">
    </div>
  </div>
</div>

When I check Element on Chrome, I have the value="123-45-6789", but is not showing on front end.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You have an <input type="number">, which is used only for numbers. But "123-45-6789" is not a number:

<input type="number" value="123-45-6789">

Since you’re trying to display a text value, use an <input type="text"> instead:

<input type="text" value="123-45-6789">

Basically, just because text contains number characters does not mean that it is a number. Social security numbers, phone numbers, address components, etc.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading