jQuery .click无法识别

时间:2012-11-05 11:50:19

标签: javascript jquery html

我无法弄清楚这部分代码的内容如下:

$(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>

1 个答案:

答案 0 :(得分:4)

尝试使用委托:

$('#testimonialContent').on('click','#nextQu',function(){
        alert(".");
    return false;
  });
相关问题