javascript - mPDF hiding HTML elements -


i'm looking way hide html elements when mpdf generates pdf form not render on pdf, in case, div.

javascript not work mpdf so

visibility="hidden" on submit not work nor display="none".

hard-coding visibility="hidden" in style attribute work make element unusable.

edit: more code:

div i'm trying hide.

    <div class="initial-container">         <form id="initial" action="checkpage.php" method="post">             <input type="hidden" id="page-num" name="page-num" value="1">             <input type="text" class="initial" name="initials[]" placeholder="initials" value="<?php if($initialsentered == 'true'){ echo $initials; }  ?>">             <input type="submit" class="submit" name="submit" value="next page" id="submit">             <p class="page-num">page 1/6</p>         </form>     </div> 

generate pdf code on separate page:

if(isset($_get["pdf"])){     $pdf = new mpdf('utf-8', '', '', '', 0, 0, 0, 0, 0, 0);      $pdf->setdisplaymode('fullpage');     $pdf->list_indent_first_level = 0;  // 1 or 0 - whether indent first level of list      $pages = ["page-one.php", "page-two.php", "page-three.php", "page-four.php", "page-five.php"];      $pagecount = 0;     while($pagecount < count($pages)){         ob_start();         include $pages[$pagecount];          $template = ob_get_contents();         ob_end_clean();         $pdf->writehtml($template);         $pdf->addpage();         $pagecount++;     }      $pdf->output("probate-agreement.pdf", "i"); } 

at first attempted:

get("submit").onclick = function(){      get("initial-container").style.visibility = "hidden"; } 

but not work.

i figured out.

i used separate css page media="print" hide specific elements. attempted before did not work, found out mpdf not yet support display property non-block level elements.

wrap whatever element want control block level element , hide block element in stylesheet:

<p class="hide-this">     <input type="submit" class="what-i-want-to-hide"> </p> 

Comments