TypeHere.keyup(function (e) {
switch (e.keyCode) {
case 188: // ','
var myInputLength = TypeHere.val().length;
var myInputText = TypeHere.val().substring(0, myInputLength - 1); // remove ','
TypeHere.width(myInputLength * 6 + 15);
//Check for email validation. //You can apply webservices for any type of validation.
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
if (myInputText.length == 0) {
TypeHere.val('');
return false;
}
if(!emailReg.test(myInputText)) {
alert('Email Is Invalid');
TypeHere.val('');
return false;
}
//Create the list item on fly and apply the css
CreateLi(myInputText)
//Save into Textbox or HiddenField
var strValue = txtValues.val() + myInputText + ';';
txtValues.val(strValue);
//Push the textbox to the right
TypeHere.width(myInputLength * 6 + 15);
//Make the input width to default and set as blank
liTypeHere.css('left', TypeHere.position().left + TypeHere.width() + 10);
TypeHere.val('');
TypeHere.width(10);
break;
}
});
分享到:
相关推荐
用javascript TextBoxList:多选输入智能提示框,
自动填充控件方便查询、 一个使用Prototype library开发具有autocomplete功能类似于Facebook的TextboxList控件。
TextboxList很棒! 如何使用 TextboxList本质上非常易于使用,但具有极高的可配置性和可扩展性。 让我们回顾一些示例使用场景: #JS new TextboxList('form_tags_input'); 这会将<input id="form_tags_input"&...
VC for EditBox control is added to the list of selection box
TextboxList是一个用户友好的控件,允许您使用单个文本框管理多个输入。
NULL 博文链接:https://xalydxn.iteye.com/blog/731078
超酷的autoComplate组件“textboxlist”
主要介绍了js 动态为textbox添加下拉框数据源的方法,需要的朋友可以参考下