input文本框--去首尾空格

html代码


    <input type="text" id="test" name="test" class="input-xs " />

js代码

    $(".input-xs:text").each(function () {
        jQuery(this).change(function () {
          jQuery(this).val(jQuery.trim(jQuery(this).val()));
        })
      })

猜你喜欢

转载自blog.csdn.net/icecoola_/article/details/80446959