开发者

create <image> in <td>

开发者 https://www.devze.com 2023-01-13 09:02 出处:网络
I want to add an <img> in a <td> $myRow = $(\"<tr></tr>\"); $开发者_JAVA技巧myRow.append(\"<td>$(\'<img/>\').attr({ src: \'xx\' })</td>\"),

I want to add an <img> in a <td>

$myRow = $("<tr></tr>");
$开发者_JAVA技巧myRow.append("<td>$('<img/>').attr({ src: 'xx' })</td>"),

as expected it's considering it as a string. How to format this using jQuery, so that it creates an <img>?


$myRow = $("<tr></tr>");
$('<td></td>').appendTo($myRow)
    .append($('<img/>')
        .attr({ src: 'xx' })
    ),
    // ...
);
0

精彩评论

暂无评论...
验证码 换一张
取 消