General developer forum

Popup Modal

 
Picture of Nilesh Pathade (eNyota Learning Pvt Ltd Pune)
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="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$( "#dialog" ).dialog({
autoOpen: false,
show: {
effect: "blind",
duration: 1000
},
hide: {
effect: "explode",
duration: 1000
}
});
$( "#opener" ).on( "click", function() {
$( "#dialog" ).dialog( "open" );
});
} );
</script>

<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>
</div>
<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: -