javascript - 在Electronjs中获取值选择(JavaScript)和网格

标签 javascript html css electron

我不知道为什么我的div中的值仅出现一次...

function nbProduct(sel) {
    var nbProduct = sel.options[sel.selectedIndex].text
    $('#tableFacture').remove();
    $('#tableFacture').remove();
    for(var i =0;i < nbProduct;i++){
        var nFacture = i + 1
        $("#product").append("<table id='tableFacture'></table>")
        $("#tableFacture").append("<th scope='row' id='rowProduct"+i+"'>Produit N°"+nFacture+"</th")
        $("#rowProduct"+i+"").append("<div class='row' syle='margin-top: 40px;' id='"+i+"'><select onChange='typeProduct(this);'><option></option><option value='"+i+"'>Velo</option><option value='"+i+"'>Trottinette</option><option value='"+i+"'>Accessoires</option></select></div>")
    }

function typeProduct(sel) {
    var typeOfProduct = sel.options[sel.selectedIndex].text
    var nbDiv = sel.options[sel.selectedIndex].value
    if (typeOfProduct == 'Velo'){  
        $("#"+nbDiv+"").append("<div class='containerFacture><select id='factureVelo'><option></option></select></div>")
        client.query('SELECT * FROM core_velo ORDER BY model DESC',(err,res)=>{
        for(var i =0;i < res.rows.length;i++){
          var item = res.rows[i];
          var model = item['model']
        $("#factureVelo").append("<option>"+model+"</option>")
        }
    client.end()
        })
    }
};
picture of my problem
我还有另一个问题,如何在electronicjs中使用grid?因为col-md/sm/XS ...不起作用。

最佳答案

您尝试使用:

function typeProduct(sel) {
    var typeOfProduct = sel.options[sel.selectedIndex].text
    var nbDiv = sel.options[sel.selectedIndex].value
    if (typeOfProduct == 'Velo'){  
        $("#"+nbDiv+"").append("<div class='containerFacture col-xs-2 offset-xs-1'><select          id='factureVelo'><option></option></select></div>")
        client.query('SELECT * FROM core_velo ORDER BY model DESC',(err,res)=>{
            var model ="";
            $.each(res, function(index, value){
                  model += value.model;
            })
            $("#factureVelo").append("<option>"+model+"</option>")
        }
    client.end()
        })
    }
};

关于javascript - 在Electronjs中获取值选择(JavaScript)和网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62655417/

相关文章:

html - 在中心对齐标签

jquery - CSS:根据图像大小在图像中制作div框

javascript - 如何在 Angular 或 Javascript 中获取多个对象中的数组结果?

javascript - 你如何在 Firebug 中一次运行一行 JavaScript?

javascript - 我的移动菜单栏中的 Href 链接不起作用

android - 背景在 iPad/Android 上无法正常显示

javascript - JavaScript 中的数字向下舍入

javascript - Three.js 相机 lookAt 没有滚动?

javascript - 当有两个或多个具有相同 ID 时操作正确的 <div>

html - 在下拉列表中插入下拉列表