Title: Override Javascript Function in Child Theme
Last modified: August 24, 2016

---

# Override Javascript Function in Child Theme

 *  Resolved Anonymous User 14393966
 * (@anonymized-14393966)
 * [11 years ago](https://wordpress.org/support/topic/override-javascript-function-in-child-theme/)
 * Hi,
 * here is a sample .js file.
 *     ```
       $(document).ready(function(){
       	function test1(){
       		alert("first function called");
   
       	};
       	function test2(){
       		alert("second function called");
       	};
       });
       ```
   
 * Is it possible to override the function `test1` in a child theme, _without_ copying
   the entire .js file into the child?
 * Thanks

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

 *  [Matthew](https://wordpress.org/support/users/kidsguide/)
 * (@kidsguide)
 * [11 years ago](https://wordpress.org/support/topic/override-javascript-function-in-child-theme/#post-6170558)
 * Check out this: wordpress.stackexchange.com/questions/26822/how-to-override-javascript-
   files-in-child-theme or this [http://stackoverflow.com/questions/24430903/overriding-parent-theme-javascript-from-child-theme](http://stackoverflow.com/questions/24430903/overriding-parent-theme-javascript-from-child-theme)
 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [11 years ago](https://wordpress.org/support/topic/override-javascript-function-in-child-theme/#post-6170560)
 * Please review the Codex on how to properly enqueue scripts (review the links 
   and resources here):
 * [https://codex.wordpress.org/Function_Reference/wp_enqueue_script](https://codex.wordpress.org/Function_Reference/wp_enqueue_script)
 *  Thread Starter Anonymous User 14393966
 * (@anonymized-14393966)
 * [11 years ago](https://wordpress.org/support/topic/override-javascript-function-in-child-theme/#post-6170823)
 * Thanks for the replies.
 * Confirms it’s all or nothing.
 * You can’t just add/change one function in .js file in an child when it is part
   of a larger file in the parent theme.
 * You have to:
    – copy the entire .js file into the child theme – make the changes
   to only one function in the child theme – then enqueue the entire .js file in
   the child theme to over ride the parent
 *  [Matthew](https://wordpress.org/support/users/kidsguide/)
 * (@kidsguide)
 * [11 years ago](https://wordpress.org/support/topic/override-javascript-function-in-child-theme/#post-6170824)
 * > You have to:
   >  – copy the entire .js file into the child theme – make the changes
   > to only one function in the child theme – then enqueue the entire .js file 
   > in the child theme to over ride the parent
 * Great! Glad you found a solution.

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

The topic ‘Override Javascript Function in Child Theme’ is closed to new replies.

## Tags

 * [child theme](https://wordpress.org/support/topic-tag/child-theme/)
 * [function](https://wordpress.org/support/topic-tag/function/)
 * [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: [Matthew](https://wordpress.org/support/users/kidsguide/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/override-javascript-function-in-child-theme/#post-6170824)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
