0

As title says I need to adjust width of input on page load according to text that is called in it with php:

<input type="text" name="name" class="contact" value="<?php echo "$name"; ?>">

Is there a way to get width of text in it and then set width of input?

Thank you!

Jakob
  • 3,493
  • 4
  • 26
  • 42

1 Answers1

0

You can do this on page load with jQuery

$(function(){
   $('.contact').attr('size',$('.contact').val().length);
})
Paul Radich
  • 605
  • 3
  • 9