Knowledge Base - How do I edit a JS file?

First, keep in mind you should only edit JS files that are designed to be edited. This includes the PARAMS files and the KJESiteSpecific.js file. No other JS files should be modified. Doing so may break your calculators. In addition, any changes you make to any other JS file (other than the KJESiteSpecific.js or the PARAMS files) will be wiped out with the application of any future update.

To edit, simply open the file in any text editor make your changes (and of course save them). Notepad can work, but may be difficult to manage long lines that wrap. You can use this FREE Notepad++ editor: https://notepad-plus-plus.org/ . You can also find free JavaScript editor options on the web. You don't need to know JavaScript to make simple changes, but some knowledge will be very helpful. Programmers with JavaScript experience will find making changes and edits a simple process.

When you edit JS files to include changes to the JS code, from examples below or as instructed by KJE make sure that you follow these basic rules of thumb:

  1. Make a backup first (or at least be able to redownload your original package)
  2. JS files are JavaScript code files. The code will execute from the top down. If an error is created in the code no other lines of code in the file will be executed. So if you made a change at the bottom of the file that never seems to make a difference, there could be an error in the file above it.
  3. All lines need to end with a ; and should not have a line break. If you have a long string of text inside quotation markes, it needs to be all on the same line to work.
  4. When in doubt, contact us. We can help out with a lot of code examples and trouble shoot should a JS file that has you stumped. Please feel free to contact us before you spend countless hours trying to figure something out. If you are stuck, give us a shout!