Tag: js

Tip: Consistent index in HTML drop-down list and JS array

Problem: Populate a drop-down list with array values. After a user selects a value, get the array index of that value. Solution: Populate the value attributes with the array indexes. These are hidden from the user. Here’s a working example: The page is nothing but a drop-down list: When a selection is made, a text is printed: P.S. In this example the first option is Select Car. It is not […]

Continue Reading →

How to make a pdf from user input on website

Problem: Generate a pdf on a website (client side) with user input. Solution: Use the pdfMake library! To get started, make a html file: Save the above code as an html file. Also save the two scripts (pdfmake.js and vfs_fonts.js) in the same folder. Then open the html file in a browser, fill in a name, and click the button. You should now be able to save or open a […]

Continue Reading →