I am querying and displaying list of posts which also have buttons. I am trying to get the button ID when clicked. Its running on console but failing from editor.
php: testDisplay.php
include('../../common/database.mysqli.php');
        $conn = new common();
        // $page= $_POST["page"];
        $query = $conn->get_query("SELECT * FROM test_posts");
        $count = $conn->find_no_rows($query);
        $output .= '<ul id="inserted-data">';
        if ($count > 0) {
            while ($results = $conn->fetch_assoc_array($query)) {
            $output .= '<li class="data-list">'. $results['post'] .'
                                        <button class="data-delete" id="del-'. $results['id'] .'">Delete</button>
                                        <button class="data-update" id="edit-'. $results['id'] .'">Update</button>
                                    </li>';
            // echo $results['id'];                     
            }
            $output .= '</ul>';
        }
        
        echo $output;
        //inserting this ul inside other class through jQuery below
jQuery:
this is bringing php data and loading through ajax
`
function loadPost(page){
        $.ajax({
            url: "include/testDisplay.php",
            method: "POST",
            data: {page:page},
            success: function (data) {
                $('.other').html(data);
            }
        });
        
    }
    loadPost();
;`
this gives me ID in console but failing in editor -
$(".data-delete").bind('click', function(){
            console.log(this.id);
        })
 
    