0

我无法弄清楚这部分代码是怎么回事,如下所示:

$(document).ready(function(){
    $('#testimonialContent').load('http://www.1.co.uk/wp-content/themes/1/testimonialPull.php');
  $('#nextQu').click(function(){
        alert(".");
    return false;
  });
});

当我应该收到警报消息时,我没有收到。我认为我没有犯任何语法错误?

HTML:

<?php
    require_once('../../../wp-blog-header.php');
    header('HTTP/1.1 200 OK');
?>
<br /><br /><br /><br /><br /><img id="quoteOne" src="http://www.1.co.uk/wp-content/themes/1/images/quote1.png">
    <span><?php
        query_posts(array(
            'cat' => 39,
            'order' => 'ASC', // ASC
            'orderby' => 'rand',
            'showposts' => 1,
            ));
        $wp_query->is_archive = true; $wp_query->is_home = false;
        if (have_posts()) : while (have_posts()) : the_post();
        the_content();
        endwhile; endif;


    ?>
    <span id="nextQu">NEXT QUOTE</span>
    </span>
4

1 回答 1

4

尝试使用委托:

$('#testimonialContent').on('click','#nextQu',function(){
        alert(".");
    return false;
  });
于 2012-11-05T11:52:35.737 回答