Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.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动态复选框_Jquery_List_Mobile_Jquery Mobile_Checkbox - Fatal编程技术网

带有数据传递和移动视图的jquery动态复选框

带有数据传递和移动视图的jquery动态复选框,jquery,list,mobile,jquery-mobile,checkbox,Jquery,List,Mobile,Jquery Mobile,Checkbox,我在移动应用程序中,我想创建一个动态复选框列表,将一些数据传递给另一个函数。我希望此复选框列表看起来像移动应用程序 而不是简单的链接 这是我的密码 for (i = 0; i < len; i += 1) { row = resultflatname.rows.item(i); if (row.flatdescription == flatdescription) { if (row.rece

我在移动应用程序中,我想创建一个动态复选框列表,将一些数据传递给另一个函数。我希望此复选框列表看起来像移动应用程序

而不是简单的链接

这是我的密码

        for (i = 0; i < len; i += 1) {
            row = resultflatname.rows.item(i);

            if (row.flatdescription == flatdescription) {
                if (row.receiptno == 0){
                        items.push('<input type="checkbox" name="code_'+ i +'" id="code_'+ i +'" value="' + row.amount + '" previous="' + row.pastpayments + '" barcode="' + row.barcode + '" todayp="' + row.todaypayments + '"/><label for="code_'+ i +'">' + row.period +'..........'+ row.amount+'</label></br>');
                allbarcode[i] = row.barcode;
                previouspayments = previouspayments + row.pastpayments;
                previouspayments = previouspayments.toFixed(2);
                sofeilon = sofeilon + row.amount;
                sofeilon = sofeilon.toFixed(2);
                total = total + row.amount - row.pastpayments;
                total = total.toFixed(2);

                } else {

                if ((row.receiptno > 0) && (row.todaypayments < row.amount - row.pastpayments)){
                        items.push('<input type="checkbox" name="code_'+ i +'" id="code_'+ i +'" value="' + row.amount + '" previous="' + row.pastpayments + '" barcode="' + row.barcode + '" todayp="' + row.todaypayments + '"/><label for="code_'+ i +'">' + row.period +'..........'+ row.amount+'</label></br>');
                allbarcode[i] = row.barcode;
                previouspayments = previouspayments + row.pastpayments;
                previouspayments = previouspayments.toFixed(2);
                sofeilon = sofeilon + row.amount;
                sofeilon = sofeilon.toFixed(2);
                total = total + row.amount - row.pastpayments;
                total = total.toFixed(2);

                }
                }
            }
            list.html(items.join('\n'));

        }

不要将锚点元素推送到数组并连接它们,而是在推送到数组之前将它们包装到列表项元素中:

items.push('<li><input type="checkbox" name="code_'+ i +'" id="code_'+ i +'" value="' + row.amount + '" previous="' + row.pastpayments + '" barcode="' + row.barcode + '" todayp="' + row.todaypayments + '"/><label for="code_'+ i +'">' + row.period +'..........'+ row.amount+'</label></li>');
list.html('<ul data-role="listview">' + items.join('') + '</ul>').trigger('create');
list.html('<ul data-role="listview">' + items.join('') + '</ul>').children().trigger('create');