Jquery验证数字范围(Jquery validate number range)
我想在jquery验证规则中将有效数字从-1设置为无穷大,但是我应该如何指定数字范围。 从我指定的“-1”和它的工作,但在什么应该是值。
rules: { "numberOfUsers": { "required": true, "number":true, "range":[-1,1000] }
- 谢谢
I want to set the valid number from -1 to infinity in the jquery validate rules, but how should i specify the number range. In from i specified "-1" and its working but in to what should be the value.
rules: { "numberOfUsers": { "required": true, "number":true, "range":[-1,1000] }
-- Thanks
原文:https://stackoverflow.com/questions/13797838
更新时间:2023-10-20 22:10
最满意答案
您可以使用:
if (preg_match('/\$\D*(\d+(?:,\d+)*)/', $input, $matches)) { echo $matches[1] . "\n"; // 10,00 }
RegEx演示
You can use:
if (preg_match('/\$\D*(\d+(?:,\d+)*)/', $input, $matches)) { echo $matches[1] . "\n"; // 10,00 }
RegEx Demo
相关问答
更多-
$美元符号(The $ dollar sign)[2022-04-16]
我已经看到这两种方式。 所有你正在做的是创建一个名为'$ selector'的变量,所以它们在功能上是等效的。 关于它的好处是它确实可以让他们轻松选择jQuery对象。 I've seen it done both ways. All you are doing is creating a variable with the name '$selector', so they are functionally equivalent. The nice thing about it is that it do ... -
1)美元符号未分配,几年前还是我记得错了吗? 这是正确的,仍然是真的。 2)什么是美元符号,如果不是jQuery? Firefox和Chrome实现$ , $$和其他几个作为助手命令。 两者都将将$$设置为document.querySelectorAll() ,并将$设置$ document.querySelector如果window.$尚未定义。 所以你看到的并不是标准的JavaScript,而是浏览器的开发者控制台的帮手。 它也不是jQuery(只要你不在使用jQuery的页面上)。 但是,它的行为接 ...
-
美元符号的含义($)(Meaning of the dollar sign($))[2022-03-14]
是的,这是一个字符串。 它将简单地附加到massConvoMsg的末尾,并且处理的组合事物是单个字符串。 Yes, that is a string. It will simply be appended to the end of massConvoMsg and the combined thing treated is single string. -
Postgresql逃脱美元符号(Postgresql escape dollar sign)[2022-06-30]
使用双美元内的任何字符串来区分它: select $anything$abc$$anything$; ?column? ---------- abc$ insert是相似的: insert into t (a, b) values ($anything$abc$$anything$, $xyz$abc$$xyz$); INSERT 0 1 select * from t; a | b ------+------ abc$ | abc$ Use any string inside ... -
逃离美元符号(escaping the dollar sign)[2023-07-05]
如果您的目的是仅更改具有该特定目录的路径,则需要更加棘手。 你必须在没有尾随/的行的末尾捕获它,并且你还必须在它具有尾随/ (行尾或不行)的任何地方捕获它。 但是你不想捕获像/var/lib/mysqlplus这样的/var/lib/mysqlplus因为那是一个完全不同的目录。 考虑使用扩展正则表达式,并使用不同的分隔符,因此命令看起来不像锯齿( /\/\/\/\/\/\/\/\ )。 通过这些更改,以及对正则表达式本身的一个小修改,它可以正常工作: $ echo ' /var/lib/mysqlplus ... -
是。 在你的情况下,你真的想要使用window的load事件,你可以简单地在你的事件处理程序中使用一个局部变量: jQuery(window).bind("load", function() { var $ = jQuery; // Use $ here... }); 或者你可以使用内联调用的函数: (function($) { // Use $ here... $(window).bind("load", function() { // Page is ...
-
美元符号被迫左转或右转(Dollar sign forced left or right)[2021-12-23]
你可以做的一种方法是使用pipe | (替代运营商): ^(\$\d{1,3}|\d{1,3}\$)$ 请参阅DEMO One of the ways you can do is using pipe | (alternative operator): ^(\$\d{1,3}|\d{1,3}\$)$ See DEMO -
您可以使用replace将$字符replace为空字符串: var price = $("div").text().replace("$", ""); 请注意,在您的确切示例(使用该间距)的情况下,空格不会被删除。 如果你打算使用字符串作为数字(例如通过parseFloat ),但是如果你想将它用作其他地方的文本,你可能想用jQuery的.trim 。 更新 - 基于评论 replace返回一个字符串。 一旦你有了这个字符串,你可以用parseFloat (或parseInt ,但你正在处理浮点数)将它解 ...
-
您可以使用: if (preg_match('/\$\D*(\d+(?:,\d+)*)/', $input, $matches)) { echo $matches[1] . "\n"; // 10,00 } RegEx演示 You can use: if (preg_match('/\$\D*(\d+(?:,\d+)*)/', $input, $matches)) { echo $matches[1] . "\n"; // 10,00 } RegEx Demo
-
给出的查询将选择concept_description包含$的行,但我假设您想要实际提取美元金额? 如果一个字段中只有一美元金额,则可以使用它来提取 SELECT SUBSTRING( concept_description, LOCATE('$', concept_description), LOCATE(' ', concept_description, LOCATE('$', concept_description)) - LOCATE('$', concept_descrip ...