Title: javascript conflict
Last modified: August 20, 2016

---

# javascript conflict

 *  [4culture](https://wordpress.org/support/users/4culture/)
 * (@4culture)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/javascript-conflict-2/)
 * I am using the Sight theme and have included a javascript file in functions.php(
   related to a drop-down menu I added in the header) and it is causing a conflict
   with the scripts.js file that is already part of the theme.
 * When i disable script.js, my dropdown menu works but the view option feature 
   between grid and list doesn’t work (referred to in scripts.js). When I disable
   jquerydropdownPlain.js (my menu script), the view option works but my drop-down
   menu breaks. My first thought was that the code in script.js that refers to the
   dropdown menu included with sight (which I do not use) was causing a conflict.
   However, I have not been able to figure out how to delete just that section.
 * Thanks in advance for any advice.
 * **my script in functions.php**
 *     ```
       // Load jQuery
       	if ( !is_admin() ) {
       	   wp_deregister_script('jquery');
       	   wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"), false);
       	   wp_enqueue_script('jquery');
   
       	   wp_register_script('topmenu', get_bloginfo('template_directory') . "/js/jquerydropdownPlain.js");
       	   wp_enqueue_script('topmenu');
       	}
       ```
   
 * **script.js included in header.php**
 *     ```
       wp_enqueue_script('script', get_template_directory_uri() . '/js/script.js', 'jquery', false);
       ```
   
 * **The javascript of jquerydropdownPlain.js**
 *     ```
       $(function(){
   
           $("#dropdown li").hover(function(){
   
               $(this).addClass("hover");
               $('ul:first',this).css('visibility', 'visible');
   
           }, function(){
   
               $(this).removeClass("hover");
               $('ul:first',this).css('visibility', 'hidden');
   
           });
   
           $("#dropdown li ul li:has(ul)").find("a:first").append(" &raquo; ");
   
       });
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [4culture](https://wordpress.org/support/users/4culture/)
 * (@4culture)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/javascript-conflict-2/#post-2398955)
 * Just to update: I was able to get both scripts to work by putting this in the
   footer.php.
 *     ```
       <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery-1.4.2.min.js"></script>
        <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquerydropdownPlain.js"></script>
       ```
   
 * for some reason, now it doesn’t conflict with script.js. and it seems to load
   quickly.

Viewing 1 replies (of 1 total)

The topic ‘javascript conflict’ 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/)
 * 1 reply
 * 1 participant
 * Last reply from: [4culture](https://wordpress.org/support/users/4culture/)
 * Last activity: [14 years, 7 months ago](https://wordpress.org/support/topic/javascript-conflict-2/#post-2398955)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
