and jQuery? I have a website where HTML is just a mess (created by the SharePoint designer). I ne...">

<style type = "text / css" media = "print"> and jQuery?

I have a website where HTML is just a mess (created by the SharePoint designer).

I need to print a page, but it looks like crap in a preview in IE7 / 8, so I need to use <style type="text/css" media="print">some tables, divs, etc., to change, but many elements do not have a class or identifier. Is there a way to use the print stylesheet and jQuery together to find elements? When I search on Google, most of the links relate to switching style sheets.

Thanks in advance.

+3
source share
1 answer

jQuery ADD, , . ​​

.

$("p:last-child").addClass("last-para");
$("tr:odd").addClass("odd-row");
$("table:eq(5)").addClass("table6"); // 6th table, starting from a 0 index!

, jQuery, () .

$("table").each(function(index, value) {
    $(this).addClass("table" + index);
    $("tr", this).each(function(index, value) {
        $(this).addClass("row" + index);
    });
});

, , .

+5

Source: https://habr.com/ru/post/1759039/


All Articles