Jotter
Jotter

Reputation: 91

Jquery find 'pre' apply css

I'm using jquery to fetch some data and so far so good. Can I apply styling to the retrieved data? I would like to add a solid horizontal line after each pre tag.

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

Upvotes: 0

Views: 116

Answers (1)

Stefan Ticu
Stefan Ticu

Reputation: 2103

You should use an each statement

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

Upvotes: 1

Related Questions