Title: Shortcode doesnt render checkbox
Last modified: June 3, 2019

---

# Shortcode doesnt render checkbox

 *  [Auraya86](https://wordpress.org/support/users/auraya86/)
 * (@auraya86)
 * [7 years ago](https://wordpress.org/support/topic/shortcode-doesnt-render-checkbox/)
 * Hi,
 * I have a very strange effect in my custom shortcode.
    I want to build an accordion
   on different content pages via shortcode. But I can’t execute the js multiple
   times, just one time on initial load.
 * I can’t create the accordion via css, because my input fields are NOT in the 
   DOM. So it can’t be an css problem.
 * This is how I add the shortcode-accordion
 *     ```
       function add_accordion($atts){
           $a = shortcode_atts( array(
                 'id' => '',
                 'class' => ''
              ), $atts );
   
               ob_start();
   
               wp_enqueue_script( "accordionjs" );
   
               set_query_var( 'post_id', absint( $a['id']) );
               set_query_var( 'class',  $a['class'] );
   
              get_template_part('template-parts/accordion');
   
               return ob_get_clean();
       }
   
       add_shortcode( 'accordion', 'add_accordion' );
       ```
   
 * In my accordion.php I am not able to render a simple checkbox like this:
    `<input
   type="checkbox" name="chk1" id="chk1" />`
 * Where are my input field or the script tags for javascript?
    I am using AngularJS
   with the current WordPress-Version.
 * Do you know this problem?

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

 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [7 years ago](https://wordpress.org/support/topic/shortcode-doesnt-render-checkbox/#post-11601561)
 * Hi!
 * Where are you registering the script `accodionjs` from?
 *  Thread Starter [Auraya86](https://wordpress.org/support/users/auraya86/)
 * (@auraya86)
 * [7 years ago](https://wordpress.org/support/topic/shortcode-doesnt-render-checkbox/#post-11601601)
 * Thanks for your time Jose!!
 * After searching several days for the solution, I actually found the problem today
   accidently and on my own 🙂 It was just an angular problem.
 * I included the wordpress content via angular. I used the ng-bind-html Attribute
   for it. With the compile-directive (see link below) the input fields and javascript
   works fine again!!
 * Please see here how the compile directive works.
 * > [ng-click on element inserted using ng-bind-html not firing](https://www.reddit.com/r/angularjs/comments/312mbg/ngclick_on_element_inserted_using_ngbindhtml_not/)
   > 
   > by[u/jp246](https://www.reddit.com/user/jp246/) in[angularjs](https://www.reddit.com/r/angularjs/)
 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [7 years ago](https://wordpress.org/support/topic/shortcode-doesnt-render-checkbox/#post-11601635)
 * Ah, that would do it, lol
 * Be sure to mark it as resolved so others know it is 😀

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

The topic ‘Shortcode doesnt render checkbox’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/shortcode-doesnt-render-checkbox/#post-11601635)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
