Title: onClick breaks shortcode when adding ]
Last modified: August 31, 2016

---

# onClick breaks shortcode when adding ]

 *  Resolved [evilhidden](https://wordpress.org/support/users/evilhidden/)
 * (@evilhidden)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/onclick-breaks-shortcode-when-adding/)
 * Hi,
 * I’m trying to add a button with an onClick event. Here is what I’m trying to 
   add `_gaq.push(['_trackEvent','Download','PDF',this.href]);`
 * As soon as that goes in the button breaks. It starts thinking that the last few
   characters are part of the text of the button itself. I’ve tried every variation
   I can think of – with quotes, without quotes, no semicolon, etc.
 * I started stripping off characters at the end one-by-one. When the closing bracket“]”
   is removed, the button works; however, that renders the js inoperable.
 * It also looks like the actual rendered page is very odd. It’s taking the last
   characters of the onClick and adding them to another line and removing others
   all together. It also makes the actual link fail. It’s adding the entire URL 
   before the full link.
 * Am I doing something wrong here? Any options to fix?
 * [https://wordpress.org/plugins/shortcodes-ultimate/](https://wordpress.org/plugins/shortcodes-ultimate/)

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

 *  [Roland](https://wordpress.org/support/users/pmcbrabant/)
 * (@pmcbrabant)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/onclick-breaks-shortcode-when-adding/#post-7446072)
 * Have you tried the knowledge base answer for nesting shortcodes?
    [http://gndev.info/kb/how-to-use-another-shortcodes-inside-of-attributes/](http://gndev.info/kb/how-to-use-another-shortcodes-inside-of-attributes/)
 *  Thread Starter [evilhidden](https://wordpress.org/support/users/evilhidden/)
 * (@evilhidden)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/onclick-breaks-shortcode-when-adding/#post-7446105)
 * That worked. Thanks!

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

The topic ‘onClick breaks shortcode when adding ]’ is closed to new replies.

 * ![](https://ps.w.org/shortcodes-ultimate/assets/icon-256x256.gif?rev=2547563)
 * [Shortcodes Ultimate - Content Elements](https://wordpress.org/plugins/shortcodes-ultimate/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcodes-ultimate/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcodes-ultimate/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcodes-ultimate/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcodes-ultimate/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcodes-ultimate/reviews/)

## Tags

 * [button](https://wordpress.org/support/topic-tag/button/)
 * [onclick](https://wordpress.org/support/topic-tag/onclick/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 2 replies
 * 2 participants
 * Last reply from: [evilhidden](https://wordpress.org/support/users/evilhidden/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/onclick-breaks-shortcode-when-adding/#post-7446105)
 * Status: resolved