jquery自动去除form表单中input框前后的空格
1.
2.
<script type="text/javascript"> $(document).ready(function() { $('#searchform input').keyup(trimkeyup); }); function trimkeyup(e) { lucene_objInput = $(this); if(e.keyCode != 38 && e.keyCode != 40 && e.keyCode != 13) { var im = $.trim(lucene_objInput.val()); lucene_objInput.val(im); } } </script>