code.youlikeshare.com
This tutorial teaches you on how to load a custom js (javascript) file into wordpress plugin. This is useful if you already have function written in js file and would like them to be used on the plugin you about to develop.
  1. Create a new js file, named as custom.js, into your plugin folder
  2. Add a simple script to alert hello on the success page load. Please take note to use jQuery on wordpress instead of $.
    
    jQuery(document).ready(function($){
    	alert("Hello javascript");
    });
    		
  3. Add the following code into your plugin module to load the custom javascript. For example, an option page on wordpress admin.
    
    function load_myscript(){
    	wp_register_script('myscript', plugins_url('custom.js', __FILE__) );
    	wp_enqueue_script('myscript');
    }
    add_action('admin_enqueue_scripts', 'load_myscript');
    
    
  4. Done. You should notice a message box of Hello javascript when you refresh your plugin option page.