Jquery 查找 'pre' 应用 css

Jquery find 'pre' apply css

我正在使用 jquery 获取一些数据,目前一切顺利。我可以对检索到的数据应用样式吗?我想在每个 pre 标签后添加一条水平实线。

$.get(dataSrc, function (data) {
      success:  function () {
       var tags = $(data).find('pre');
       $("#div1").empty().append(tags);
       };
});

您应该使用 each 语句

$('pre', $(data)).each(function(){
    // 'this' refers to the pre element
    $(this).append(your_line);
})