小编use*_*108的帖子

jquery多个复选框数组

<input type="checkbox" name="options[]" value="1" />
<input type="checkbox" name="options[]" value="2" />
<input type="checkbox" name="options[]" value="3" />
<input type="checkbox" name="options[]" value="4" />
<input type="checkbox" name="options[]" value="5" />
Run Code Online (Sandbox Code Playgroud)

如何使用已选中的复选框值创建数组?

注意:(重要)我需要像[1,2,3,4,5]这样的数组,而不是像["1","2","3","4","5"]那样的数组.
注意:大约有50个复选框.

有人能帮我吗?请!

谢谢!

arrays checkbox jquery

37
推荐指数
2
解决办法
9万
查看次数

[0-9] +和[0-9] ++有什么区别?

有人可以解释一下[0-9]+和之间的区别是[0-9]++什么?

php regex

7
推荐指数
2
解决办法
6265
查看次数

Vue 3:TypeError:compiler.parseComponent 不是函数

我似乎无法摆脱这个错误。

我试过删除package-lock.json&node_modules后跟npm install,但是,它不起作用。

  • 节点版本: 12.18.3
  • NPM 版本: 6.14.8

任何帮助表示赞赏!


可爱的错误

ERROR in ./src/scripts/Test.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: compiler.parseComponent is not a function
    at parse (some path\node_modules\@vue\component-compiler-utils\dist\parse.js:15:23)
    at Object.module.exports (some path\node_modules\vue-loader\lib\index.js:67:22)
 @ ./src/scripts/app.js 8:0-30 10:10-14
Run Code Online (Sandbox Code Playgroud)

包.json

{
    "name": "app",
    "version": "1.0.0",
    "description": "",
    "private": true,
    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "devDependencies": {
        "@vue/compiler-sfc": "^3.0.2",
        "vue-loader": "^15.9.4",
        "webpack": "^4.44.1",
        "webpack-cli": "^3.3.12" …
Run Code Online (Sandbox Code Playgroud)

node.js webpack vue.js

7
推荐指数
1
解决办法
3078
查看次数

JavaScript(正则表达式):从输出中排除匹配项

我有这样的文字:暂准非text600 ELIT其中600动态添加.我怎么才能得到它?

var str = ('nisi non text600 elit').match(/text\d+/);
alert(str);
Run Code Online (Sandbox Code Playgroud)

这会警告text600,如何在没有额外替换单词文本的情况下仅提醒600(如果可能的话)?

任何帮助表示赞赏,谢谢!

javascript regex jquery

5
推荐指数
2
解决办法
331
查看次数

何时使用deferred.reject()?

我对何时使用deferred.resolve()和感到非常困惑deferred.reject()

快速范例

var doSomething = function() {

    var deferred = $.Deferred();

    if ( typeof myVar === "object" ) {

        // Do something with myVar - Start.

            deferred.resolve();

        // Do something with myVar - End.

    } else {

        // myVar isn't an object, but the function has finished executing
        // and that's what I want to know.
        // With reject() I'll be forced to use always() instead of done()
        // because there'll be also a fail() method …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-deferred

2
推荐指数
1
解决办法
5099
查看次数

使用php简单dom解析下拉菜单

我想用php简单的dom解析这个下拉菜单.

<select name="example">  
    <option value="1">First example</option>  
    <option value="2">Second example</option>  
    <option value="3">Third example</option>
</select>
Run Code Online (Sandbox Code Playgroud)

我需要此下拉菜单的值和选项.

php simple-html-dom

1
推荐指数
1
解决办法
3304
查看次数

jQuery在IE上返回一个空输入值

HTML:

<div id="fields">
    <input type="text" name="someField" />
    <!-- NOTE: There are some more fields here -->
</div>
<!-- NOTE: There are some more fields here -->
Run Code Online (Sandbox Code Playgroud)

第一个JS文件:

jQuery(document).ready(function($) {
    alert($('#fields input[type="text"]').val());
});
Run Code Online (Sandbox Code Playgroud)

第二个JS文件:

jQuery(document).ready(function($) {
    $('#fields input[type="text"]').val('someValue');
});
Run Code Online (Sandbox Code Playgroud)

笔记:

  1. JS文件位于head标记内.
  2. 我被迫在第二个JS文件中设置输入值.
  3. 它适用于Firefox,Opera,Chrome,Safari.
  4. IE7和IE8返回一个空值.

任何帮助表示赞赏!谢谢!

javascript jquery internet-explorer-8 internet-explorer-7

1
推荐指数
1
解决办法
2852
查看次数