Title: javascript problems
Last modified: August 20, 2016

---

# javascript problems

 *  [questuk](https://wordpress.org/support/users/questuk/)
 * (@questuk)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/javascript-problems-2/)
 * Earlier today i thought i typed in the right code in my php function file for
   adding Javascript which was wp_enqueue_script( Unfortunately, an error occured
   i was unable to fix the error as a consequence i lost all my work. Thankfully,
   i reinstalled wordpress and i have got most of my work that i lost back. To avoid
   making the same mistake again can somebody please tell the correct method of 
   adding javascript to wordpress.
    Thank you

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

 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [14 years, 1 month ago](https://wordpress.org/support/topic/javascript-problems-2/#post-2667043)
 * Give this a read.
 * [http://codex.wordpress.org/Using_Javascript](http://codex.wordpress.org/Using_Javascript)
 * >  Unfortunately, an error occured i was unable to fix the error as a consequence
   > i lost all my work.
 * And remember: make backups of your files before you edit them. 😉
 *  Thread Starter [questuk](https://wordpress.org/support/users/questuk/)
 * (@questuk)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/javascript-problems-2/#post-2667044)
 * Thanks Jan, I have read that before. The strange thing is that i typed in the
   exact code that was listed wp_enqueue_script( in theme functions and it did not
   work. Backups you mean copy and paste in notepad? I dont want this to happen 
   again. Any advice would be most welcome.
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [14 years, 1 month ago](https://wordpress.org/support/topic/javascript-problems-2/#post-2667053)
 * As you’ve know, when you are using `add_action('wp_enqueue_scripts', 'my_scripts_method');`
   you need to (typically) add that your theme’s `functions.php` file.
 * If you are editing `functions.php` then make a copy of that file before you edit
   it. You can usually do that via your hosts file management tool or plain FTP.
 * By keeping a backup copy then if something goes wrong you can put it back the
   way it was before you edited it. It’s a good way to get out of a problem that
   you may have created.
 * For editing notepad does work, but you may like [Notepad++](http://notepad-plus-plus.org/)
   better. It formats your code as well as provided line numbers.
 * [http://codex.wordpress.org/Editing_Files#Editing_Files_Offline](http://codex.wordpress.org/Editing_Files#Editing_Files_Offline)

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

The topic ‘javascript problems’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * Last activity: [14 years, 1 month ago](https://wordpress.org/support/topic/javascript-problems-2/#post-2667053)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
