How do I use a dialog box in plain html?

I am trying to use Jquery in plain HTML, but in doing so I am unable to execute it. I think I am missing the link

Title

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">      </script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script src="http://jqueryui.com/resources/demos/style.css"></script>

      

Script

 $( document ).ready(function() {
     $("#btnShare").click(function(){
         alert("Click executed");
         $( "#menu" ).menu();
     });
 });

      

At the bottom I have the code with <li>

and <ul>

.

I am trying to use this code in Notepad ++. I might get a warning. Can someone help me.

Any help would help.

+3


source to share


4 answers


trying to open a window dialog

when clicked btnShare

?

if so change $("#menu").menu();

to$('#menu').dialog('open');



I think this is your problem if I understand you correctly.

and here is a basic JSFIDDLE showing what I think you are after

0


source


Try this.actually you added extra "});" Tag



$( document ).ready(function() {
$("#btnShare").click(function(){
alert("Click executed");
 $( "#menu" ).menu();
});
});

      

+1


source


You are missing script tags

<script>

$( document ).ready(function() {
 $("#btnShare").click(function(){
   alert("Click executed");
    $( "#menu" ).menu();
     });
    });

</script>

      

0


source


I edited the post.

Now you can see that you have one });

.

 $( document ).ready(function() {
     $("#btnShare").click(function(){
         alert("Click executed");
         $( "#menu" ).menu();
     });
 });

      

This is always useful for debugging, for formatting code. An IDE like PHP Storm can do this with a single Key Combo.

0


source







All Articles