Saturday, 15 March 2014

javascript - Adjust input size according to lenght of text on page load -



javascript - Adjust input size according to lenght of text on page load -

as title says need adjust width of input on page load according text called in php:

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

is there way width of text in , set width of input?

thank you!

you can on page load jquery

$(function(){ $('.contact').attr('size',$('.contact').val().length); })

javascript jquery

No comments:

Post a Comment