[resolved] Conflict between my JQuery and PHP scripts (5 posts)

  1. chdemers
    Posted 4 years ago #

    It seems that my PHP script interferes with my slidetoggle function, and I don't know why.

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

  2. chrismccorkle
    Posted 4 years ago #

    Ack, you forgot to use the code button. Paste your code again, select all, and click the button above.

  3. chdemers
    Posted 4 years ago #

    [easyembed field="testpat"] //calls custom field, which is this slide toggle function http://api.jquery.com/slideToggle/
    <div id="monBloc">Lorem Ipsum</div>
    Contenu masqué
    <?php global $post;
    $args = array( 'numberposts' => 4, 'offset'=> 0, 'category' => 140 );
    $myposts = get_posts( $args );
    foreach( $myposts as $post ) : setup_postdata($post); ?>
    " target='_blank' ><?php the_excerpt(); ?><?php endforeach; ?>

  4. Oleg Dudkin
    Posted 4 years ago #

    What do you mean by "PHP script interferes with my slidetoggle function"?
    What exactly happens and what is expected, maybe you can post link to your site?
    JavaScript can't interfere with PHP in any way. If you have JavaScript error, that's probably conflict between two JavaScript scripts. If you have wrong HTML generated by PHP - problem is in PHP and there is nothing to do with JavaScript.
    You probably should post that part of JavaScript where you call slideToggle and part of PHP code that generates HTML of that section that needs to be toggled.

  5. Kakoma
    Posted 4 years ago #

    Hi chdemers,
    As Oleg pointed out, you'll need to provide more detail. However, the jQuery '$' does present some issues on some sites. This can be resolved by replacing all instances of $ by jQuery

    with :

Topic Closed

This topic has been closed to new replies.

About this Topic