Hello. Began to deal with jQuery. Writing:

<script type="text/javascript"> $(".right").hover(function() { $(".right").animate( { width: '15%' }, 1500, function() { $(this).html("<p><a href='#'> Оставить отзыв</a> </p> "); }) }) 

and then I try to do something like this with "Leave a review":

 $(".right pa").toggle( function() { $(".left").animate( { opacity: '1' }, 1500); }, function() { $(".left").animate( { opacity: '0' }, 1500); }) 

but nothing happens. How correctly to address these elements, prompt, please?

    2 answers 2

    Try replacing lines like $ (". Right"). Animate ( with $ (this) .animate ( . And once again reconsider, the correctness of the selection element.
    By the way, if the .right and .right pa elements are added to the page dynamically, these events are not attached to them. Read about the live () method.

    • Yes, apparently, live () is what I need. thank! - tfiwsrets 2:21 pm

    As an option, put it out separately ...$(".right pa").toggle( ... in the function newFunction() and in <p><a href='#'> Оставить отзыв</a> </p> add onclick="newFunction()"