Title: jQuery problem
Last modified: August 20, 2016

---

# jQuery problem

 *  [MajinSaha](https://wordpress.org/support/users/majinsaha/)
 * (@majinsaha)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/jquery-problem-4/)
 * Hello everyone!
    This is not really related to how wp files work, but rather 
   to directory structure of WordPress installation. I created a simple html file(
   independent of WordPress) inside wp-content folder to test jQuery scripts that
   I am working on. I am using
 *     ```
       <script type="text/javascript" scr="jquery-whatever-version.js"></script>
       <script type="text/javascript" scr="blabla.js"></script>
       ```
   
 * inside <head> tags of my file to load the script. These scripts won’t load.
    
   However, the same file gives the expected results if copied to the home folder
   of WordPress. Both jQuery library and the script itself I am loading are copied
   along with this file to the same location. So I suppose there must be some magic
   that makes every folder beside home restrict script loading. But why? Can you
   explain what is going on? It doesn’t influence my work anyhow, it is just a test
   file for learning how jQuery works. I also have been choosing whether to post
   this in WP forum or jQuery forum, and decided to choose the first one, since 
   not everyone in jQuery community knows WordPress. Thanks for your answers.

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

 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/jquery-problem-4/#post-2355170)
 * A safe way of adding javascripts to a WordPress generated page is to use [wp enqueue script](http://codex.wordpress.org/Function_Reference/wp_enqueue_script)
   and use the `$deps` argument to tell it that your script depends on jquery. You
   put the wp enqueue script code in your theme’s functions.php:
    [http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Load_a_script_from_your_theme_which_depends_upon_a_WordPress_Script](http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Load_a_script_from_your_theme_which_depends_upon_a_WordPress_Script)
 *  [fyllhund](https://wordpress.org/support/users/fyllhund/)
 * (@fyllhund)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/jquery-problem-4/#post-2355173)
 * or just link it correctly in html.
 * wp-content/folder/folder/folder/jquery.js
    or wherever you placed the file.
 * If you link like that html believes the file is in the wordpress folder aka
 * localhost/yoursite/jquery.js
 *  Thread Starter [MajinSaha](https://wordpress.org/support/users/majinsaha/)
 * (@majinsaha)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/jquery-problem-4/#post-2355207)
 * I don’t really know what happened but it works now. All I did I moved my files
   back to wp-content after they started working in the home folder (which is one
   level higher). I didn’t change a slight bit in the code including paths.
    Maybe
   there’s a bug in Firefox or whatever. Thanks for all the answers.

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

The topic ‘jQuery problem’ is closed to new replies.

## Tags

 * [jquery](https://wordpress.org/support/topic-tag/jquery/)
 * [script](https://wordpress.org/support/topic-tag/script/)
 * [wp-content](https://wordpress.org/support/topic-tag/wp-content/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [MajinSaha](https://wordpress.org/support/users/majinsaha/)
 * Last activity: [14 years, 7 months ago](https://wordpress.org/support/topic/jquery-problem-4/#post-2355207)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
