- 
אשמח אם מישהו כאן יכול לתרגם לי את הקוד דלהלן מJQuery ל j.s רגיל // Download button (PNG) $("#download-image").on('click', function() { $(this).attr('href', $('#pdf-canvas').get(0).toDataURL()); // Specfify download option with name $(this).attr('download', 'page.png'); }); // Download button (JPEG with quality 80%) $("#download-image").on('click', function() { $(this).attr('href', $('#pdf-canvas').get(0).toDataURL("image/jpeg", 0.8)); // Specfify download option with name $(this).attr('download', 'page.jpg'); });
- 
אשמח אם מישהו כאן יכול לתרגם לי את הקוד דלהלן מJQuery ל j.s רגיל // Download button (PNG) $("#download-image").on('click', function() { $(this).attr('href', $('#pdf-canvas').get(0).toDataURL()); // Specfify download option with name $(this).attr('download', 'page.png'); }); // Download button (JPEG with quality 80%) $("#download-image").on('click', function() { $(this).attr('href', $('#pdf-canvas').get(0).toDataURL("image/jpeg", 0.8)); // Specfify download option with name $(this).attr('download', 'page.jpg'); });@ב-ל פעם הבאה תעשה גוגל // Download button (PNG) document.getElementById('download-image').addEventListener('click', (e) => { this.attr('href', document.getElementById('pdf-canvas').get(0).toDataURL()) // Specfify download option with name this.attr('download', 'page.png') }) // Download button (JPEG with quality 80%) document.getElementById('download-image').addEventListener('click', (e) => { this.attr('href', document.getElementById('pdf-canvas').get(0).toDataURL('image/jpeg', 0.8)) // Specfify download option with name this.attr('download', 'page.jpg') })
- 
@ב-ל פעם הבאה תעשה גוגל // Download button (PNG) document.getElementById('download-image').addEventListener('click', (e) => { this.attr('href', document.getElementById('pdf-canvas').get(0).toDataURL()) // Specfify download option with name this.attr('download', 'page.png') }) // Download button (JPEG with quality 80%) document.getElementById('download-image').addEventListener('click', (e) => { this.attr('href', document.getElementById('pdf-canvas').get(0).toDataURL('image/jpeg', 0.8)) // Specfify download option with name this.attr('download', 'page.jpg') })
- 
- 
@ב-ל צודק, יש לומר setAttribute// Download button (PNG) document.getElementById('download-image').addEventListener('click', (e) => { this.setAttribute('href', document.getElementById('pdf-canvas').get(0).toDataURL()) // Specfify download option with name this.setAttribute('download', 'page.png') }) // Download button (JPEG with quality 80%) document.getElementById('download-image').addEventListener('click', (e) => { this.setAttribute('href', document.getElementById('pdf-canvas').get(0).toDataURL('image/jpeg', 0.8)) // Specfify download option with name this.setAttribute('download', 'page.jpg') })
- 
@ב-ל צודק, יש לומר setAttribute// Download button (PNG) document.getElementById('download-image').addEventListener('click', (e) => { this.setAttribute('href', document.getElementById('pdf-canvas').get(0).toDataURL()) // Specfify download option with name this.setAttribute('download', 'page.png') }) // Download button (JPEG with quality 80%) document.getElementById('download-image').addEventListener('click', (e) => { this.setAttribute('href', document.getElementById('pdf-canvas').get(0).toDataURL('image/jpeg', 0.8)) // Specfify download option with name this.setAttribute('download', 'page.jpg') })
- 
@ב-ל פעם הבאה תעשה גוגל // Download button (PNG) document.getElementById('download-image').addEventListener('click', (e) => { this.attr('href', document.getElementById('pdf-canvas').get(0).toDataURL()) // Specfify download option with name this.attr('download', 'page.png') }) // Download button (JPEG with quality 80%) document.getElementById('download-image').addEventListener('click', (e) => { this.attr('href', document.getElementById('pdf-canvas').get(0).toDataURL('image/jpeg', 0.8)) // Specfify download option with name this.attr('download', 'page.jpg') })
- 
@chv אמר בעזרה - .'תרגום' קטע קטן בJQuery לj.s: document.getElementById('pdf-canvas').get(0) כמדומני שזה אמור להחזיר רק אלמנט אחד (ולא סט), אז .get אמור להכשל. @חגי אמר בעזרה - .'תרגום' קטע קטן בJQuery לj.s: @chv אמר בעזרה - .'תרגום' קטע קטן בJQuery לj.s: document.getElementById('pdf-canvas').get(0) כמדומני שזה אמור להחזיר רק אלמנט אחד (ולא סט), אז .get אמור להכשל. צודק.. 
 צ"ל לקחת ישירות את ה-dataurl מהאלמנט// Download button (PNG) document.getElementById('download-image').addEventListener('click', (e) => { this.setAttribute('href', document.getElementById('pdf-canvas').toDataURL()) // Specfify download option with name this.setAttribute('download', 'page.png') }) // Download button (JPEG with quality 80%) document.getElementById('download-image').addEventListener('click', (e) => { this.setAttribute('href', document.getElementById('pdf-canvas').toDataURL('image/jpeg', 0.8)) // Specfify download option with name this.setAttribute('download', 'page.jpg') })@dovid תכל'ס - צודק.. 
- 
 D dovid העביר נושא זה מ-תכנות ב- D dovid העביר נושא זה מ-תכנות ב-
 

