0

How long a string can I fit into the value attribute of a html input field?

<input type="text" value="how-long-long-long-long" size="21" />

I'm trying to add comma separated values into a hidden text field - but these values are getting fetched from another developer. I tried to look up for this threshold value in The Bible but they don't have it there.

Please help me.

Probosckie
  • 1,585
  • 4
  • 25
  • 40
  • possible duplicate of [Is there a limit to the length of HTML attributes?](http://stackoverflow.com/questions/1496096/is-there-a-limit-to-the-length-of-html-attributes) – bish Jun 30 '15 at 04:55

1 Answers1

0

There are no limits, but be logical if you think there is too much data than there probably is. Check out this codepen and just keep typing into the input it can go on for well... a long time.

http://codepen.io/anon/pen/qdpgGQ

Jquery to show length and update view:

$('#name').keyup(function () {
  $('#display').text($(this).val());

var myLength = $("#name").val().length;
  $('#display1').text(myLength);

});
Spade
  • 591
  • 3
  • 20