Is there a way to ignore certain other HTML elements whilst using the html type?
I'd like to be able to print a DIV however there is one particular element I'd like to ignore.
Hey @Aloogy , the library doesn't have this feature. Interesting idea though. Maybe we could implement it.
Same here, this would be a feature I could use.
Either ignoring elements or being able to include multiple elements.
Thinking about implementing this.
How about adding an option within the html function to pass an array of ids for the elements that are supposed to be ignored?
Yes that would work. So this array of ids are children of the element id (to print)?
Correct.
Awesome, let me know and i'll test it.
Just publish this feature to npm. You can run npm update print-js to get it.
I'll be adding it to the documentation page. We now have an extra parameter ignoreElements, which accepts an array of html element ids that we can tell the library to ignore when printing a parent element.
For ex.:
printJS({
printable: 'printElementId',
type: 'html',
ignoreElements: ['elementIdToIgnore', 'anotherElementIdToIgnore']
})
Here is a fiddle as a example:
https://jsfiddle.net/crabbly/tr8btp3s/
Most helpful comment
Thinking about implementing this.
How about adding an option within the html function to pass an array of
idsfor the elements that are supposed to be ignored?