Is there a way to define the modal content in the javascript, rather than always having to have an element on the page and create the dialog from that?
It has the title option, so I can 'dynamically' create a modal title, but what about the actual content? Like say I need it to say, "you are going to delete image #539". Rather than creating a modal for every possible image - or even from creating the element and then making the dialog from that.
There's got to be a better way.
Thank you Scott. I have added a title attribute for the dialog:
...
...
Demo
Here's another solution, a bit more dynamic:
Then when you need to call the error modal simply do:
You can imagine adding more parameters to the function to control the width, height, etc.
Enjoy!
You could try something like this:
HTML
Javascript
Demo here.