jQuery Automatic Trim of Input Fields
December 23, 2008 – 12:59 pmReally common task with a really easy solution
$(function()
{
$(“input”).change( function() { $(this).attr(“value”, $.trim( $(this).attr(“value”) ) ) });
});
This attaches a function to the ‘change’ event of all <input> tags. When the input field is changed it uses the built in ‘trim()’ function of jquery to trim off whitespace.
Related posts:
- jQuery – Add a default button to a page Normally in HTML you can add a ‘input type=”submit”‘...
- Save HTML Table to Excel using jQuery After a few hours work looking into this, this...
- Autoresponders = Automatic Internet Marketing Success Since there are so many different uses for autoresponders,...
