0

I have a div that, when hovered is supposed to transform another div into a jquery ui dialog.

 <a href="#"><div class="btn button" id="btn button" value="">Click here for a dialog!</></a><br><span class="tooltip">rgba(66, 222, 57, .8);</span>

    <div id="are-you-sure" title="Dialog">Here it is!<br><br></div>


    <script>
    $('#btn').mouseover(function(){
       $('#are-you-sure').dialog();
    });
    </script>   

I have all of the necessary stylesheets and scripts linked to my page, but the dialog still doesn't work. Any ideas?

yainspan
  • 4,191
  • 3
  • 26
  • 48

3 Answers3

2

From MDN: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id

This attribute's value must not contain white spaces. Browsers treat non-conforming IDs that contains white spaces as if the white space is part of the ID. In contrast to the class attribute, which allows space-separated values, elements can only have one single ID defined through the id attribute. Note that an element may have several IDs, but the others should be set by another means, such as via a script interfacing with the DOM interface of the element.

You can't set multiple IDs via the attribute.

Rakesh Guha
  • 346
  • 2
  • 10
0

You should always have unique ids, adding the classes as id is not very good programming practice. If you want this to happen for all button with these classes then your selector should be:

$('.btn.button').mouseover(function(){

If you want it to be specific to this one then give it a meaningful id such as 'openDialog' and then the selector should be:

$('#openDialog').mouseover(function(){

Thats what I can see straight off, not necessarily the only errors.

Dhunt
  • 1,524
  • 9
  • 22
-2

Please find the below link for the answer needed.

enter link description here

var opt = {
    autoOpen: false,
    modal: true,
    width: 550,
    height:650,
    title: 'Details'
};    

$('#btnbutton').mouseover(function () {
   $('#are-you-sure').dialog(opt).dialog('open');
});
Jace Rhea
  • 4,944
  • 4
  • 35
  • 55
chetank
  • 394
  • 3
  • 16