I have the following html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<dialog id="my-dialog"></dialog>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script><scripttype="text/javascript">
$(document).ready(function () {
$('#my-dialog').showModal();
});
</script>
</body>
</html>
I can open the dialog with the following javascript:
document.getElementById("my-dialog").showModal();
But I did not find a way to open the modal using jQuery, I already tried this:
$('#my-dialog').showModal();
But I get the following error:
Uncaught TypeError: $(...).showModal is not a function
Is there a way to open a dialog using jQuery?