lundi 11 octobre 2021

Dynamically created checkbox not clickable

I am creating dynamic posts data on ajax call in which i am creating checkboxes also. but checkbox is not clickable. it is being showed on document but not responding on click. no showing tick i mean checked and uncheked states on user clicks. Everything is working fine except checkboxes. I did not done any jquery for checkboxes yet. In Console i checked checkbox html and id value etc shown properly here is my code //

if(mysqli_num_rows($result) > 0){

    $output = "";
    $output .= "<div class='col-12'><p id='content-title'>Fresh Posts</p></div>";

    while($row = mysqli_fetch_assoc($result)) {

        $title = substr($row['title'],0,25) . '...';
        $description = substr($row['description'],0,200) . '...';

        $output .= "<div class='col-4'>
        <div class='post-content'>
        <a href='single-post.php?id={$row['post_id']}' class='post-img'>
        <img src='dashboard/uploads/{$row['post_img']}'>";
        if(isset($_SESSION['logged-in'])){
            $output .= "<input type='checkbox' id='{$row["post_id"]}' value='{$row['post_id']}' class='fav-icon-checkbox'>
                        <label for='{$row["post_id"]}'><i class='fa fa-heart fav-icon'></i></label>";
        }
        $output .= "</a>
        <div class='post-info-container'>
        <div class='post-info'>
        <span class='post-author'><a href='#'>{$row['author']}</a></span>
        <span class='dot'></span>
        <span class='post-category'><a href='category.php?id={$row['category_id']}'>{$row['category_name']}</a></span>
        <br>
        <span class='post-date'>{$row['date']}</span>
        </div>
        <h5 class='post-title'>{$title}</h5>
        <p class='post-description'>{$description}<a href='single-post.php?id={$row['post_id']}' class='read-more'>read more</a></p>
        </div>
        </div>
        </div>";
    }

    echo $output;
}



Aucun commentaire:

Enregistrer un commentaire