samedi 27 juin 2015

How do i ignore div which style = none with JSPDF

i have a situation,in which i have to ignore some divs, i'am using a JSPDF plugin, the idea is to get only some div(which are the result of user choices), JSPDF get the code frome html, so it get even the hidden divs.

this is my code, but it's not working, any help will be appreciated,

var doc = new jsPDF();

var specialElementHandlers = {

    '#editor': function (element, renderer) {

        return true;
    }

};


     $("div[style*='display:none']").remove();

    doc.fromHTML($('#resultat').html(),15, 15,{
        'width': 170,
            'elementHandlers': specialElementHandlers
    });




    doc.output("dataurlnewwindow");


<div id="resultatConflit" style="display:none">
                    &lt;label><b>Test de Conflit</b>&lt;/label>
                    <div id="TNeer" style="display:none">
                        &lt;label for="cnfl1">Test de Neer &lt;/label>
                        <div id="cnfl1"></div>
                    </div>
                    <div id="ADouloureux" style="display:none">
                        &lt;label for="cnfl2">Arc Douleureux &lt;/label>
                        <div id="cnfl2"></div>
                    </div>
                    <div id="Yowm" style="display:none">
                        &lt;label for="cnfl3">Yowm &lt;/label>
                        <div id="cnfl3"></div>
                    </div>
                    <div id="THKenedy" style="display:none">
                        &lt;label for="cnfl4">Test de Howkins-Kenedy &lt;/label>
                        <div id="cnfl4"></div>
                    </div>
                    <div id="CATest" style="display:none">
                        &lt;label for="cnfl5">Cross Abduction Test &lt;/label>
                        <div id="cnfl5"></div>
                    </div> .

Aucun commentaire:

Enregistrer un commentaire