Vanilla JS Prompt Modals Library Examples

Download Back To CSSScript.Com

A JavaScript modal library for creating clean-looking and fully customizable alert or confirmation popup windows.

Default close button prompt



show_prompt('Default close button', 'Do you want to color heading?', false, undefined, 'Yes', `document.getElementById('demo-heading').style.background = '#04AA6D';document.getElementById('modal-alert').style.display = 'none'`)

No close button prompt



show_prompt('No close button prompt', 'Do you want to reload?', true, '', 'Reload', `location.reload();`)

Custom buttons prompt



show_prompt('Default close button', 'Visit cssscript.com?', false, 'No', 'Yes', `window.open('https://www.cssscript.com');document.getElementById('modal-alert').style.display = 'none'`)

Simple alert prompt



show_prompt('Simple alert prompt', 'Only close button')

The full function to call

show_prompt(title, message, pribtnHide = false, pribtnLabel = "Close", secBtnLabel = '', secBtnAction = '')