I'm using something like this:

The jquery load:

jQuery(document).ready(function() {
        jQuery('.navigation a').live('click', function(e){
        e.preventDefault();
        var link = jQuery(this).attr('href');
        jQuery('#load').fadeTo(200, 0).load(link + ' #load-posts', function(){ jQuery('#load').fadeTo(200, 1); });      
        });

    });

The Wordpress Loop

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" class="post-tip-<?php the_ID(); ?>"><?php echo substr($post->post_title,0,15); ?></a>

    <div class="post-tip-item-<?php echo $post->ID; ?>" style="display: none;">
    post tip content
    </div><!-- /#post-tip-item-<?php the_ID(); ?> -->

    <script type='text/javascript'>jQuery(document).ready(function() {  jQuery('a.post-tip-<?php echo $post->ID; ?>').easyTooltip({ useElement: 'post-tip-item-<?php echo $post->ID; ?>'}); });</script>

    <?php endwhile; ?>
 <div class="navigation">

    <?php posts_nav_link('','','&laquo; Previous Entries') ?>


    <?php posts_nav_link('','Next Entries &raquo;','') ?>

 </div>
<?php else : ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

The problem is that after for example the load changes the page and gets the next posts this is not loaded anymore:

<script type='text/javascript'>jQuery(document).ready(function() {  jQuery('a.post-tip-<?php echo $post->ID; ?>').easyTooltip({ useElement: 'post-tip-item-<?php echo $post->ID; ?>'}); });</script>

If someone knows the solution, it will be great! Thanks

link|improve this question

60% accept rate
How are you adding the script? Is it a link in the header? Is it being enqueued in the functions.php file like it's supposed to be done? Have you registered the same script twice? You might want to look into turning wp_debug on. The Firefox plugins, WebDeveloper and Firebug are useful when de-bugging js issues. – Jeremy Jared Nov 11 '11 at 20:59
the script works great and is added using enqueue, the only thing is that afte looping next posts the <script...>.... </script> is not loaded for the posts. – Fnarp Nov 11 '11 at 21:04
Just a quick comment (not directly related to your issue, but relevant regardless). It isn't hard to use js in WordPress the right way once you figure it out. You should really avoid inline javascript. You could save your inline scripts to a file named custom-scripts.js, then add them via your functions.php file. Here's a post that you might want to read: mattvarone.com/wordpress/add-css-javascript-wordpress-theme – Jeremy Jared Nov 11 '11 at 21:09
I used to add inline js like you have. Now I create a file for the code, save it to a folder named js on my server and call it in WordPress functions.php like this: function contact_form_script() { if ( !is_page_template( 'contact.php' ) ) return; wp_enqueue_script( 'mypagescript', get_template_directory_uri() . '/js/jquery.validate.min.js', array('jquery')); wp_enqueue_script( 'mypagescripttwo', get_template_directory_uri() . '/js/verify.js', array('jquery')); } add_action( 'template_redirect', 'contact_form_script' ); – Jeremy Jared Nov 11 '11 at 21:16
If you install the Firefox plugin addons.mozilla.org/en-US/firefox/addon/web-developer, you can go to a page of your website and choose Information>View Javascript. This will show all js files that are being loaded. You can expand the links to see if they are being loaded and check to ensure none are loaded twice. – Jeremy Jared Nov 12 '11 at 13:36
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.