Title: onclick-Function in WordPress Theme
Last modified: February 2, 2019

---

# onclick-Function in WordPress Theme

 *  [leamoser](https://wordpress.org/support/users/leamoser/)
 * (@leamoser)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/onclick-function-in-wordpress-theme/)
 * **I got the following problem: **
    I want, that on the mobile version of my site
   the header-navigation can be opened and closed by clicking on the burger icon.
   I was able to code exactly that with a really simple javascript-function on another
   site. But when I tried to set it up on this site, it just wouldn’t work.
 * **So my questions are:**
    1. Does Javascript even work in WP-Themes? 2. Can I
   solve this Issue with PHP somehow? 3. How can I make it, that my function runs
   when the button is being clicked?
 * Thanks a lot for your help!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fonclick-function-in-wordpress-theme%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [lisa](https://wordpress.org/support/users/contentiskey/)
 * (@contentiskey)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/onclick-function-in-wordpress-theme/#post-11160754)
 * Suggestion:
 * Download the theme and heck the code for a free theme like [https://wordpress.org/themes/twentyseventeen/](https://wordpress.org/themes/twentyseventeen/)
   to see how the configuration is done for a mobile menu to open/collapse.
 * Use the theme files as a model/guide for setting up the proper JavaScript and
   PHP functions so your site can operate in a similar way.
 *  [ranjani](https://wordpress.org/support/users/ranjani/)
 * (@ranjani)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/onclick-function-in-wordpress-theme/#post-11374604)
 * Hello my website is [http://www.oodaru.com](http://www.oodaru.com). I have created
   it on wordpress. and the theme is WordPress Theme 775.
    (wordpress version 5.1.1)
   The side bar is changed upto the body (text) length. Could you please help me
   to fix the problem as look like on original WordPress Theme 775. I mean to help
   to reset the side bar on the left side.
    -  This reply was modified 7 years, 2 months ago by [ranjani](https://wordpress.org/support/users/ranjani/).
    -  This reply was modified 7 years, 2 months ago by [ranjani](https://wordpress.org/support/users/ranjani/).

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

The topic ‘onclick-Function in WordPress Theme’ is closed to new replies.

## Tags

 * [Action hooks](https://wordpress.org/support/topic-tag/action-hooks/)
 * [add_action](https://wordpress.org/support/topic-tag/add_action/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [wp themes](https://wordpress.org/support/topic-tag/wp-themes/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 3 participants
 * Last reply from: [ranjani](https://wordpress.org/support/users/ranjani/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/onclick-function-in-wordpress-theme/#post-11374604)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
