Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello ...

Iam geeting this issue that modal wont pop up bootstrap5 when i add the id

<button type="button" class="btn btn-icon rounded-circle btn-outline-danger"
    data-bs-toggle="modal" data-bs-target="#default{{ $Country->id }}">
    "trash-2">
</button>



Modal:


HTML
<div class="modal fade text-start" id="default{{ $Country->id }}" tabindex="-1"
            aria-labelledby="myModalLabel1" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title" id="myModalLabel1">Basic Modal</h4>
                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    </div>
                    <div class="modal-body">
                        <h5>Check First Paragraph</h5>
                        <p>
                            Oat cake ice cream candy chocolate cake chocolate cake cotton candy dragée apple pie. Brownie
                            carrot cake candy canes bonbon fruitcake topping halvah. Cake sweet roll cake cheesecake cookie
                            chocolate cake liquorice.
                        </p>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary" data-bs-dismiss="modal">Accept</button>
                    </div>
                </div>
            </div>
        </div>


What I have tried:

when i remove id it works but i need the id to delete record
Posted
Comments
Richard Deeming 24-Aug-22 11:36am    
If it works when you remove the {{ $Country ->id }}, then that suggests there's a problem with your IDs.

Right-click on the button and select "Inspect" to view the element in your browser's developer tools. What is the data-bs-target attribute set to?
khalid4775 24-Aug-22 11:50am    
the IDs is ok

i have inspect the element data-bs-target="#default1"

the id is 1

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900