Download Back To CSSScript.Com
A 3KB vanilla JS plugin that loads Bootstrap 5 modal content via Fetch API. No jQuery required. Promise-based callbacks included.
Load content from a URL with default settings.
loadmodal('content-simple.html');
Load a form, add custom buttons, and handle callbacks.
loadmodal({
url: 'content-form.html',
title: 'Login Form',
id: 'login-modal',
buttons: {
'Login': (evt) => {
alert('Login clicked!');
// return false to prevent closing
},
'Cancel': false // Closes dialog
}
});
Use the promise-style API for events.
loadmodal({ url: 'content-simple.html', title: 'Event Test' })
.create(() => console.log('Created'))
.show(() => console.log('Shown'))
.close(() => console.log('Closed'));