❔ my string event click isn't working

im trying to include this div inside my gridData, but once i store it in shareBtnvariable it doesnot work
but once i get it out of the Scripts it works normally

((all the idea is to trigger
data-kt-menu-trigger="click"
which will automatically do everything) which is not triggering

what is the problem
@section Scripts {
    <partial name="_GridViewResourcesScript" />
    <partial name="_ValidationScriptsPartial" />

    <script>
        $(document).ready(function () {
const dt = $('#gridData').DataTable({
                "createdRow": function (row, data, index) {
                    // actions column
                    var shareBtn = `
                        <div class="d-flex align-items-center mx-1 mx-lg-3">
                            <div onclick=showShareMenu() class=" btn btn-icon  web-br-circle headerImage-box p-3 w-40px h-30px w-md-40px h-md-40px"
                                    data-kt-menu-trigger="click"
                                    data-kt-menu-attach="parent"
                                    data-kt-menu-placement="bottom-end"
                                    data-kt-menu-flip="bottom">
                                <?xml version="1.0" encoding="UTF-8" ?>
                                <here is svg > 
                            </div>
                            <!--begin::Menu sub (this menu should appear when clicking into svg >
                            <div class="menu menu-sub  data-kt-menu="true">
                                <button id="fb" class="btn w-full">
                                    Share Facebook
                                </button>
                                    </div>
                                </div>`;

                    var btnGroup = `<div class="btn-group"> ${shareBtn} </div>`;
                    var table = $('#gridData').DataTable();
                    var cell = table.cell(index, 5);
                    cell.data(btnGroup);
}
                },
Was this page helpful?