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!
You can do this on page load with jQuery
$(function(){
$('.contact').attr('size',$('.contact').val().length);
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.