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>
The above is the detailed content of How to remove the spaces before and after the input box in jquery?. For more information, please follow other related articles on the PHP Chinese website!