Skip to content
Advertisement

Input value from HTML not passing to modal

I am trying to pass the reservation id from HTML to modal. In pictures, when I click “cancel” next to reservation: preview of the screen A modal appears and it should contain the id number of reservation: preview

Modal pops up but without the reservation id number. Please, what’s wrong?

I followed this tutorial: https://www.geeksforgeeks.org/how-to-pass-data-into-a-bootstrap-modal/. Thank you.

Here is my code:

JavaScript

Advertisement

Answer

You are assigning value of {{ histor.booking_id }} to placeholder instead use value="{{ histor.booking_id }}" .Then , use class for click event and inside this get value of input using $(this).prev().val() and put it inside your modal.

Demo Code :

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement