浅克隆[Plain Clone]:
1 | var obj1 = {foo: "foo", bar: "bar"}; |
JSON克隆[Json Clone]
1 | var obj = { a: 0, b: { c: 0 } }; |
深度克隆[Deep Clone]
1 | function deepClone(obj) { |
浅克隆[Plain Clone]:
1 | var obj1 = {foo: "foo", bar: "bar"}; |
JSON克隆[Json Clone]
1 | var obj = { a: 0, b: { c: 0 } }; |
深度克隆[Deep Clone]
1 | function deepClone(obj) { |
为避免用户输入非法数据,希望能对某些输入框的输入做限制。这里用价格输入框(只允许输入最多2位小数的非负数值)
来做例子:
1 | <input type="text" id="price" name="price" placeholder="请输入价格(最多2位小数)" required> |
1 | //用了jQuery |
注:
pattern="[+\d]?\d*\.?\d{0,2}"
)只能限制最后的结果,不能限制输入不当的字符。Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
1 | $ hexo new "My New Post" |
More info: Writing
1 | $ hexo server |
More info: Server
1 | $ hexo generate |
More info: Generating
1 | $ hexo deploy |
More info: Deployment