0

jquery not working in after second grid

   <div class="carousel slide carousel1" id="myCarousel1">
      <div class="carousel-inner"><?php 
       $args = array('post_type'=>'post','post_status'=>'publish','orderby'=>'menu_order','order'=>'ASC','posts_per_page'=>'2',
           'tax_query' => array(array('taxonomy' =>'category','field'=>'slug','terms'=>'videos')));
       $team = new WP_Query($args);
       if($team->have_posts()){
           while ( $team->have_posts() ) : $team->the_post();?>
              <div class="item">
                 <div class="panel col-md-4 col-xs-12">                        
                    <div class="panel-header">
                        <h4><?php the_title();?></h4>                                                      
                    </div>  

                 </div>
              </div><?php 
              endwhile;
           }?>                 
       </div>

    </div>

JS

 $(document).ready(function() {

      $( ".panel-header h4" ).click(function() {
            alert('sdfds');
        });
});
4
  • 1
    If this is not a PHP issue, please do not post PHP. Click edit and then [<>] snippet editor and produce a minimal reproducible example using HTML, CSS and Script Commented Apr 27, 2019 at 7:45
  • create jsfiddle with your code Commented Apr 27, 2019 at 8:10
  • Are you getting any console errors? Commented Apr 27, 2019 at 8:38
  • TypeError: siteBranding is undefined Commented Apr 27, 2019 at 10:24

1 Answer 1

1

Try this:

jQuery(document).ready(function($) {
  $( ".panel-header h4" ).each(function() {
      $(this).click(function(){
         alert('sdfds');
      });

    });
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.