This project is day #13 of 31-javascript-projects!
Customizable alert and input windows!
Just download and link customizable-alerts.js and customizable-alerts.css files to your HTML. There are two functions for now: cAlert() and cInput().Just use them in the code!
To close the cAlert, just click on it!
To close the cInput, just type in the value and click the button!
cAlert(title, text, <i>opacity</i>, <i>borderRadius</i>, <i>backgroundColor</i>);
Italic params have default value: opacity = 0.8, borderRadius = 12, backgroundColor = lightblue.
cInput(title, placeholder, buttonText, <i>opacity</i>, <i>borderRadius</i>, <i>backgroundColor</i>, callback);
Italic params have default value: opacity = 0.8, borderRadius = 12, backgroundColor = lightblue.
Important!!!
cInput uses callback, so here is the example of using this function:
cInput("Enter a value:", "Placeholder", "Submit", undefined, undefined, undefined, (value) => {
console.log(value);
// value is the string that user typed in input field
// Do whatever you want with your value here
});
Planning on adding CDN soon.
Also planning to add another alert functions, but don't know if i'll ever do this!
By the way, you can test this two functions on my github pages. Link