Wednesday, March 14, 2012

Input type text element width auto resize

A small jquery function helps us making the text field resize automatically with width auto -

function resizeInput() {
    $(this).attr('size', $(this).val().length+2);
}   

$('input[type="text"]').keyup(resizeInput).each(resizeInput);


No comments:

Post a Comment