0
4

1 回答 1

4

Target all code tags that does not have a ancestor pre tag :

$('code').filter(function() {
    return !$(this).closest('pre').length;
}).css('color', 'red');

FIDDLE

于 2013-06-15T21:57:48.887 回答