views:

20

answers:

2

Hi everybody,

Is it possible to create a popup without being based on a div. Example, I have a the following DIV:

<div id="dialog" title="Info">
    <p>This is a test</p>
</div>

Instead of calling a dialog like this:

$("#dialog").dialog();

I would like to call like this:

 $("This is a test").dialog();

How would it be possible?

Thank you, Regards.

+1  A: 

You can call it like this:

 $("<div>This is a test</div>").dialog();
Alex Reitbort
A: 

To test for a string and, if found, do something (replace the hover function alert("Found"); with whatever you want to do):

<script type="text/javascript">
$(function(){
    if ($("#dialog p").text("This is a test")) {
        $("#dialog p").hover(function() {
            alert("Found");
        });
    }
});
</script>
Dave Everitt