-1

Is it possible to add a empty form field no-print insert for a FORM? Any empty form fields I do not want to print

@media print
{    
    .no-print, .no-print *
    {
        display: none !important;
    }
}
acctman
  • 4,229
  • 30
  • 98
  • 142

1 Answers1

0

I assume this will do the trick:

window.onbeforeprint = function() {
        var inputElements = document.querySelectorAll("input"),
            inputElementsLength = inputElements.length;
        for(var i=0; i< inputElementsLength, i++) {
            if(!inputElements[i].value) { // if empty
                inputElements[i].classList.add("no-print");
            }
        }
    };
mohamedrias
  • 18,326
  • 2
  • 38
  • 47