简体   繁体   English

我正在努力在 javascript 中追加行,但我实际上不知道如何在行单元格中添加 append 图像

[英]I am working on appending row in javascript but I actually don't know how to append an image in row cell

 [I am appending a row. everything appended but image not showing. I tried some ways but cant solve this problem][1]
function SearchDrivers() {
        var Id = document.getElementById('driverSearch').value;
        $.ajax({
            url: "/Administration/SearchDrivers/" + Id,
            type: "Get",
            contentType: "application/json;charset=UTF-8",
            dataType: "json",
            success: function (response) {
                var table = document.getElementById('DriverTable');
                var drivers = response['users'];
                for (var j = 0; j <= drivers.length; j++) {
                    var driver = drivers[j];
                    tr = "<tr>"
                        + "<td>" + driver['email'] + "</td>"
                        + "<td>" + driver['email'] + "</td>"
                        + "<td>" + "033138445156666" + "</td>"
                        + "<td>" + "<button class='table-btn'>unverified</button>" + "</td>" 

this is the way i am appending an image and its style.这就是我添加图像及其样式的方式。 I used some more ways to append a image but thay also not working for me.我使用了更多方法来 append 图像,但它们也不适合我。

                        + "<td>" + "<a asp-action='DriverProfile'><img class='ml-2 icon-15' src='~/svg/visibility.svg'></a>" + "</td>"
                        + "</tr>";
                    $('#DriverTable tbody').append(tr);
                }



            }
            
        });
    }

Your svg folder should be placed under wwwroot.您的svg文件夹应放在wwwroot.

Then you need to change your path to然后你需要改变你的路径

<img class='ml-2 icon-15' src='/svg/visibility.svg'></a>

Delete the ~ .删除~

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我在 Javascript 中有一个数据表,并且(几乎)一切正常,但我不知道如何引用同一行中的值......有什么想法吗? - I have a datatable in Javascript and (almost) everything works fine, but i don't know how to refer to a value in the same row...any ideas? if/else 语句似乎在 Javascript 中不起作用,我不知道我做错了什么 - If/else statements just do not seem to be working in Javascript and i don't know what I am doing wrong Javascript - 使用 document.execcommand 在现有表中添加行但我犯了一些错误但我不知道它在哪里 - Javascript - add row an existing table using document.execcommand but i made some mistake but i don't know where it is EventListener 不工作 JavaScript 我不知道为什么 - EventListener not working JavaScript and I don't know why 在javascript中已经添加一行后如何添加按钮 - How to append a button when already appending a row in javascript 我是 React 的新手,我想将普通的 javascript 代码转换为 React,我不知道该怎么做 - I am new in react i want to convert normal javascript code to the react i don't know how to do that 单击图像并将其附加到 Javascript 中的行 - Clicking on image and appending it to the row in Javascript 我要让我的 javascript 从我的图像文件夹中保留一张随机图像,在写完所有代码后图像没有显示,我不知道为什么 - i am to make my javascript keep a random image from my image folder, after writing all the codes the image is not showing and i don't know why 我有代码可以在javascript和CSS中刷新图像时将图像随机化,以格式化图像,但我不知道如何将两者结合起来 - I've got code to randomize an image on refresh in javascript and CSS to format the image but I don't know how to combine the two 如何在 Jquery 或 Javascript 中搜索和删除/附加一行? - How do I search and remove/append a row in Jquery or Javascript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM