Title: New plugin developer, jQuery script issue.
Last modified: August 19, 2016

---

# New plugin developer, jQuery script issue.

 *  [fwdrew](https://wordpress.org/support/users/fwdrew/)
 * (@fwdrew)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/new-plugin-developer-jquery-script-issue/)
 * Hello everyone,
 * I am very new to WordPress plugin development and am developing a simple plugin
   to practice and get more involved with the wordpress API. At the moment, I am
   just trying to use jQuery to prompt an alert box when the publish button is clicked
   and am having issues getting it to work properly, and am not sure what I have
   done wrong.
 *     ```
       <?php
       /**
        * @package Are Your Sure?
        * @author Drew Douglass
        * @version 1.0
        */
       /*
       Plugin Name: Are You Sure?
       Plugin URI: http://dev-tips.com
       Description: Basic plugin
       Author: Drew Douglass
       Version: 1.0
       Author URI: http://dev-tips.com
       */
       if(!function_exists('are_you_sure_init')){
       	function are_you_sure_init(){
       		$ays_js = wp_enqueue_script('aysjquery','/wp-content/plugins/aysjquery.js', array('jquery'), '1.2.6');
       		return $ays_js;
       	}
       	are_you_sure_init();
       }
   
       ?>
       ```
   
 * Above is the plugin php script located in the plugin folder.
 * Below is the jQuery script linked to in the are_you_sure_init function:
 *     ```
       $(function(){
       	$('#publish').click(function(){
       		alert('Hello!');
       		return false;
       	});
       });
       ```
   
 * In firebug I can see the script is indeed being called after jQuery is, but there
   is no alert and the publish button continues to run instead of returning false.
 * Can anyone point me in the right direction with a link or suggestion as to what
   I am doing incorrectly? Do you think it could be another Javascript code used
   by wordpress interfering with mine? I am not looking for anyone to code for me,
   just for help on where to look to solve my issue.
 * Best Regards,
 * Drew

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

 *  Thread Starter [fwdrew](https://wordpress.org/support/users/fwdrew/)
 * (@fwdrew)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/new-plugin-developer-jquery-script-issue/#post-994645)
 * I hope it wont’ offend anyone if I give this a small bump.
 *  Thread Starter [fwdrew](https://wordpress.org/support/users/fwdrew/)
 * (@fwdrew)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/new-plugin-developer-jquery-script-issue/#post-994648)
 * Well got this fixed by running jQuery in no conflict mode in case anyone else
   ever views this thread.

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

The topic ‘New plugin developer, jQuery script issue.’ is closed to new replies.

 * 2 replies
 * 1 participant
 * Last reply from: [fwdrew](https://wordpress.org/support/users/fwdrew/)
 * Last activity: [17 years, 2 months ago](https://wordpress.org/support/topic/new-plugin-developer-jquery-script-issue/#post-994648)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
