General developer forum

Popup Modal

Picture of Nilesh Pathade
Popup Modal

Hi, I am using moodle 3.4.2

I want to create a popup just like "add activity and resources" popup on course view page.

I want to open  modal popup on clicking link. which show close button and message. 

If any one has code how to create a popup? Please shared with me.

I have Try 

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Dialog - Animation</title>
<link rel="stylesheet" href="//">
<script src=""></script>
<script src=""></script>
$( function() {
$( "#dialog" ).dialog({
autoOpen: false,
show: {
effect: "blind",
duration: 1000
hide: {
effect: "explode",
duration: 1000
$( "#opener" ).on( "click", function() {
$( "#dialog" ).dialog( "open" );
} );

<div id="dialog" title="Basic dialog">
<p>This is an animated dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
<button id="opener">Open Dialog</button>

This is working in core php or html page. But when I put this code into my Moodle Page this is not working  and showing error which i have attached in screen short.

Please help me.

Average of ratings: -