Title: custom button inside admin menu
Last modified: January 8, 2024

---

# custom button inside admin menu

 *  Resolved [muradko](https://wordpress.org/support/users/muradko/)
 * (@muradko)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/custom-button-inside-admin-menu/)
 * Hello friends,
 * so i have a small plugin where i am creating an admin menu and then directing
   to another php file that is being shown when i press on the item. inside the 
   php i created a button but i do not know how to make the button do something 
   when being clicked. i tried so much js seems not to be working:
 * add_action(‘admin_menu’, ‘my_admin_menu’);
 * function my_admin_menu() {
   add_menu_page(‘MyPlugin’,‘MyPlugin’,‘manage_options’,
   plugin_dir_path(**FILE**) . ‘view.php’,null,‘dashicons-saved’,15);}
 * function wptuts_scripts_basic()
   {// Register the script like this for a theme:
   wp_register_script( ‘custom-script’, plugin_dir_path(**FILE**) . ‘app.js’ );wp_enqueue_script(‘
   custom-script’ );}
 * add_action( ‘wp_enqueue_scripts’, ‘wptuts_scripts_basic’ );
 * ——————————-
 * app.js :
 * document.getElementById(“test”).addEventListener(“click”, function () {
   console.
   log(“hello”);})
    -  This topic was modified 2 years, 4 months ago by [muradko](https://wordpress.org/support/users/muradko/).
    -  This topic was modified 2 years, 4 months ago by [muradko](https://wordpress.org/support/users/muradko/).
    -  This topic was modified 2 years, 4 months ago by [muradko](https://wordpress.org/support/users/muradko/).
    -  This topic was modified 2 years, 4 months ago by [muradko](https://wordpress.org/support/users/muradko/).
    -  This topic was modified 2 years, 4 months ago by [muradko](https://wordpress.org/support/users/muradko/).

The topic ‘custom button inside admin menu’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 0 replies
 * 1 participant
 * Last reply from: [muradko](https://wordpress.org/support/users/muradko/)
 * Last activity: [2 years, 4 months ago](https://wordpress.org/support/topic/custom-button-inside-admin-menu/)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
