Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/396.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在同一文本框上组合两个JavaScript函数_Javascript_Jquery_Jquery Plugins - Fatal编程技术网

在同一文本框上组合两个JavaScript函数

在同一文本框上组合两个JavaScript函数,javascript,jquery,jquery-plugins,Javascript,Jquery,Jquery Plugins,嗨,我有这个功能: jQuery(function ($) { $("#Log_InventoryNo").mask("aa*999999"), { placeholder: " " }; }); $('#Log_InventoryNo').maxlength({ alwaysShow: true, threshold: 10, warningClass: "label label-success", limitReachedClass: "label

嗨,我有这个功能:

jQuery(function ($) {
    $("#Log_InventoryNo").mask("aa*999999"), { placeholder: " " };
});
$('#Log_InventoryNo').maxlength({
    alwaysShow: true,
    threshold: 10,
    warningClass: "label label-success",
    limitReachedClass: "label label-important",
    separator: ' of ',
    preText: 'You have ',
    postText: ' chars remaining.',
    validate: true
});
这个功能是:

jQuery(function ($) {
    $("#Log_InventoryNo").mask("aa*999999"), { placeholder: " " };
});
$('#Log_InventoryNo').maxlength({
    alwaysShow: true,
    threshold: 10,
    warningClass: "label label-success",
    limitReachedClass: "label label-important",
    separator: ' of ',
    preText: 'You have ',
    postText: ' chars remaining.',
    validate: true
});

问题是maxlength函数使用mask函数会产生意外的结果(它自己可以很好地工作),因为有办法让这两个函数一起工作吗?我将添加mask函数与maxlength函数配合使用。当它们都被加载时,maxlength函数不起作用,并在文本框中显示不正确的值计数

看起来这些是自定义函数。我们能看看函数定义吗?我的猜测是,它们使用相同的变量名将值存储在元素的$.data()中

他们是他们写的。他们没有任何定义你是在起诉一个插件吗?没有插件的jquery中没有maxLength或mask函数。是的,我正在使用,你能创建一个fiddle(jsfiddle.net)来调试你的代码吗?否则,在执行函数之前和之后,首先在控制台中检查$(“#Log_InventoryNo”).data()。