Generating PDF files with JavaScript

I’ve just written a library called jsPDF which generates PDFs using Javascript alone. It’s still very young, and I’ll be adding features and bug fixes soon. Also got a few ideas for workarounds in browsers that do not support Data URIs. It’s licensed under a liberal MIT license. I came across this question before I started writing … Read more

TypeError getElementsByTagName is not a function issue

Does anyone have any ideas what might be causing this? The object returned by the jQuery constructor doesn’t have the .getElementsByTagName() method. $(‘selector’) returns a jQuery object. .getElementsByTagName() is a native JavaScript method of DOM elements. To look for elements with a certain tagname using the jQuery object you currently have: To get a like-for-like … Read more

How can JavaScript save to a local file?

There’s already a solution for writing file JSON online but I want to save json file locally. I’ve tried to use this example http://jsfiddle.net/RZBbY/10/ It creates a link to download the file, using this call a.attr(‘href’, ‘data:application/x-json;base64,’ + btoa(t.val())).show(); Is there a way to save the file locally instead of providing a downloadable link? There … Read more

Disabled href tag

There is no disabled attribute for hyperlinks. If you don’t want something to be linked then you’ll need to remove the <a> tag altogether. Alternatively you can remove its href attribute – though this has other UX and Accessibility issues as noted in the comments below so is not recommended.