As a beginner in using Bootstrap, I have encountered an issue where I am unable to update the textbox within the modal before the user triggers the dialog. Despite trying various methods like JavaScript and C# on the server-side, none of them seem to successfully update the textbox.
Below is a snippet of my code:
<head id="Head1" runat="server">
<script type="text/javascript">
function func(name)
{
//triggered when modal is about to be shown
$('#edit').on('show.bs.modal', function (e) {
//get data-id attribute of the clicked element
var bookId = $(e.relatedTarget).data('id');
//populate the textbox
$(e.currentTarget).find('input[name="mohsintext"]').val(bookId);
});
}
</script>
</head>
<body>
...
I have attempted multiple JavaScript approaches to updating the textbox element, all without success. Some code sections have been excluded for readability purposes, such as Bootstrap CSS file links.