开发者

Second jquery "chunk" not running

开发者 https://www.devze.com 2023-04-08 02:28 出处:网络
I have the following jquery below.When the user clicks .commentCount, I want this div called #commentSec to open up, and then some other elements on the site change.This jquery chunk runs fine.However

I have the following jquery below. When the user clicks .commentCount, I want this div called #commentSec to open up, and then some other elements on the site change. This jquery chunk runs fine. However, the second chunk, onclick of a close button called .closeComments, doesn't run at all. What am I doing wrong? Do I have to return true or something in the first jquery section? Thanks--

 $('.commentCount').click( function() {
        $('#commentSec').css({ 'display' : 'inline', 'height' : 'auto', 'padding' : '10px', 'padding-bottom' : '0px', 'margin-bottom' : '10px', 'margin-left' : '10px', 'z-index' : '10'});
        $('#commentSec h3').css({ 'display' : 'block'});
        $('#rightcolumn').css({ 'opacity' : '.3'}); //Transparent rightcolumn
    });

Second Chunk:

$('.closeComments').click( function() {
    $('#commentSec').css({ 'display' : 'none'});
    $(this).css({'opacity' : '.9'});
    $('#rightcolumn').css({ 'opacity' : '1'}); //Undo transparent rightcolumn
});

HTML/PHP:

<h3><b>' . $useranswering . '\'s</b> ANSWER</h3><img class="closeComments" src="../Images/bigclose.png" alt="close"/>
    <span><a class="prev" >&larr; previous answer</a><a 开发者_开发知识库class="next" href="">next answer &rarr;</a></span>
    <div>
    <p>' . $answer . '</p>
    <form method=post>
            <input type="hidden" value="'. $ansid .'" name="answerid">
            <textarea rows="2" cols="33" name="answercomment">Comment on this answer</textarea>

            <input type="image" src="../Images/commentSubmit.png"/>


The third line of your Second Chunk: $(this).css({'opacity' : '9'});

Should that not be: $(this).css({'opacity' : '0'});

0

精彩评论

暂无评论...
验证码 换一张
取 消