JSFiddle - React, Tailwind, and code Playground

by Martin Sjåstad

HTML

<div id="CommentPosted607">
                                    
                    
                        
                                <div class="commentPanel show_more" align="left">
        <div class="commentPadding">
            <label>
                <a onclick="javascript:void(0);" id="607" class="show_more_comments">Show all 15 comments</a>
            </label>
        </div>
    </div>
    <div class="commentPanel " id="adminComment-607-15" align="left">
    <div class="commentPadding">
        <label class="postedComments-15">
            stop being a jerk        </label>
        <br clear="all"> <!-- bra -->
        <div class="time_comments">
            25 minutes ago        </div>

            
            <div class="adminComment" id="adminComment-607" style="display: none; ">
                 
                    <a href="http://localhost.ucroo/#" class="deleteComment" id="15">Delete</a> 
                 
            </div>
                <div class="clear"></div>
    </div>
</div>    <div class="commentPanel " id="adminComment-607-14" align="left">
    <div class="commentPadding">
        <label class="postedComments-14">
            please come up in the right place        </label>
        <br clear="all"> <!-- bra -->
        <div class="time_comments">
            28 minutes ago        </div>

            
            <div class="adminComment" id="adminComment-607" style="display: none; ">
                 
                    <a href="http://localhost.ucroo/#" class="deleteComment" id="14">Delete</a> 
                 
            </div>
                <div class="clear"></div>
    </div>
</div>    <div class="commentPanel " id="adminComment-607-13" align="left">
    <div class="commentPadding">
        <label class="postedComments-13">
            note really        </label>
        <br clear="all"> <!-- bra -->
        <div class="time_comments">
            29 minutes ago        </div>

            
            <div...

JavaScript

$('.commentMark').live('keypress', function (e) {
    if (e.keyCode == '13' && commeting == false) {
        e.preventDefault();
        <?= !is_active() ? "alert(activate_message);return false;" : "" ;?>

        commeting = true; 
        
        var getpID =  $(this).parent().attr('id').replace('record-','');    
        var comment_text = $("#commentMark-"+getpID).val();
        
        if(comment_text != "Write a comment...")
        {

            $.post("<?=base_url()?>feed/comment/", {
                post_string: comment_text,
                post_id: getpID
            }, function(response){
                $('#CommentPosted'+getpID+' show_more').add($(response).fadeIn('slow'));
                $("#commentMark-"+getpID).val("");
                commeting = false;                 
            });
        }

    }
});