Is it possible to create a popup without being based on a div. Example, I have a the fo开发者_C百科llowing 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.
You can call it like this:
$("<div>This is a test</div>").dialog();
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>
精彩评论