Title: How to add new javascript file
Last modified: August 30, 2016

---

# How to add new javascript file

 *  [suzy-tm](https://wordpress.org/support/users/suzy-tm/)
 * (@suzy-tm)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-add-new-javascript-file/)
 * Hello,
 * We’ve been sent both the javascript and html to implement a new mortgage calculator(
   see attached file) for a client’s website but we’re struggling. So far, I’ve:
 * 1. created the file mortgagecalc.js and saved this in udesign/scripts
 * 2. added the following line of code to the header.php file in the theme (not 
   sure if I should as we are using a child theme):
 * `<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/scripts/
   mortgagecalc.js"></script>`
 * 3. Added the HTML to the relevant page to display the calculator [http://astonandco.co.uk/financial-services/](http://astonandco.co.uk/financial-services/)
 * I’m sure I’ve probably missed something but don’t know what! Can anyone help?
 * Thanks in advance

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [suzy-tm](https://wordpress.org/support/users/suzy-tm/)
 * (@suzy-tm)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-add-new-javascript-file/#post-6215319)
 * Oops, I referenced an attached file in the original post. The file containing
   the code [can be found here](https://www.dropbox.com/s/zlzkt4n8k82c4t5/Mortgage%20Calculator%20Code.doc?dl=0)
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-add-new-javascript-file/#post-6215320)
 * If you share your code publicly via PasteBin then we won’t have to login/ sign
   up for an account to view it: [http://pastebin.com](http://pastebin.com)
 *  anonymized-13749270
 * (@anonymized-13749270)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-add-new-javascript-file/#post-6215321)
 * Here’s the right path to the JS: [http://astonandco.co.uk/wp-content/themes/u-design/scripts/mortgagecalc.js](http://astonandco.co.uk/wp-content/themes/u-design/scripts/mortgagecalc.js),
   probably you missed that as you enqueued [http://astonandco.co.uk/js/mortgagecalc.js?ver=1.0](http://astonandco.co.uk/js/mortgagecalc.js?ver=1.0)
 *  Thread Starter [suzy-tm](https://wordpress.org/support/users/suzy-tm/)
 * (@suzy-tm)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-add-new-javascript-file/#post-6215333)
 * Andrew – thanks for the comment. Hadn’t come across pastebin before! [Here you go](http://pastebin.com/CHAkx7Gj)
 * Samuel – thanks, I’ll give that a go 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘How to add new javascript file’ is closed to new replies.

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [suzy-tm](https://wordpress.org/support/users/suzy-tm/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-add-new-javascript-file/#post-6215333)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
