Jquery - How to get the style display attribute “none / block”

后端 未结 5 610
深忆病人
深忆病人 2021-01-30 04:08

Is there a way to get the style: display attribute which would have either none or block?

DIV :

5条回答
  •  有刺的猬
    2021-01-30 04:22

    My answer

    /**
     * Display form to reply comment
     */
    function displayReplyForm(commentId) {
        var replyForm = $('#reply-form-' + commentId);
        if (replyForm.css('display') == 'block') { // Current display
            replyForm.css('display', 'none');
        } else { // Hide reply form
            replyForm.css('display', 'block');
        }
    }
    

提交回复
热议问题