避免连续的空格 [英] avoid continuous blank spaces

查看:69
本文介绍了避免连续的空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我希望在输入文本框时避免多个空格。单词之间允许单个空格。

提前谢谢

解决方案

我用它来实现所需的



这里''description''是输入html元素的id



 

' #description')。keypress( function (e){
if (e.charCode == 32 &&


this )。val()


Hi,
I want to avoid more than one blank space while typing in textbox. single blank space is allowed between words.
Thanks in advance

解决方案

I used this to achieve the required

here ''description'' is the id of the input html element


('#description').keypress(function (e) { if (e.charCode == 32 &&


(this).val()


这篇关于避免连续的空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆