Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.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
Jquery maskedinput不';不能与百分比一起工作_Jquery - Fatal编程技术网

Jquery maskedinput不';不能与百分比一起工作

Jquery maskedinput不';不能与百分比一起工作,jquery,Jquery,我正在输入上使用maskinput.js。当我在值后加上百分号时,当加载页面时,不会显示任何内容。如果没有百分号,则会显示它。有人能告诉我发生了什么事以及如何解决吗?多谢各位 面具 $(function(){$(.percent”).mask(“99%”;}); $(function(){$(“.number”).mask(“99”);}); 从我在这里看到的情况来看,似乎掩码接受一个数字,并且不将百分比识别为数字 解决方案:不要在数字后加百分号。如果数字以某种方式生成为百分比,请用类似于“

我正在输入上使用maskinput.js。当我在值后加上百分号时,当加载页面时,不会显示任何内容。如果没有百分号,则会显示它。有人能告诉我发生了什么事以及如何解决吗?多谢各位


面具
$(function(){$(.percent”).mask(“99%”;});
$(function(){$(“.number”).mask(“99”);});

从我在这里看到的情况来看,似乎
掩码
接受一个数字,并且不将百分比识别为数字


解决方案:不要在数字后加百分号。如果数字以某种方式生成为百分比,请用类似于“代码>myNumber=myNumber.split”(“%”[0]”的符号去掉百分比,这不是很理想,而是最好的答案。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> 
<title>Mask</title> 

<script src="http://code.jquery.com/jquery-latest.js"></script> 
<script src="http://yii-framework-tutorial.googlecode.com/svn-history/r3/assets/fb2a00e4/jquery.maskedinput.js" type="text/javascript"></script>

<script> 
 $(function(){$(".percent").mask("99%");});
 $(function(){$(".number").mask("99");});
</script>

</head>

<body>
 <input type="text" name="margin" class="percent" value="12" />
 <input type="text" name="number" class="number" value="12" />
</body> 
</html>