Jquery-UI对话框 - 飞行中没有DIV [英] Jquery-UI Dialog - on the fly without DIV

查看:113
本文介绍了Jquery-UI对话框 - 飞行中没有DIV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有怀疑是一个简单的问题,搜索后我怀疑我的问题的答案是否定的,但是要仔细检查...



是可以使用Jquery ui对话框设置DIV?



ie而不是..



$(function(){$(#dialog).dialog();}); ...



< div id =dialogtitle =我真的需要这个吗?>这是很多打字只是传递一个简单的消息< / div>



可能只是有一些像...



$ (函数(快速){$(#dialog).dialog('这会更容易');}); ...



您可能会注意到,我可能会通过Javascript进行干预,并通过试用和错误的方式尽我所能点击一个适用于我的解决方案。



我想,我问我是否可以以类似的方式使用对话框...



alert(这很简单)



...所以我可以打电话提醒用户,只要我需要,而不是点击或按钮按钮。



希望以上有意义,我怀疑我必须坚持丑陋的标准警报,但是让我知道是否有一个简单的解决方案。



谢谢

解决方案

我希望这有助于某人,您可以直接将html传递给对话框,如下所示:

  $ < p> Hello World!< / p>)。 

所以这样你就不必有一个预构建的div,你可以使用: / p>

  $(< div>我的div内容< / div>)。 

编辑:将结束标签更改为< / div> 而不是< / p>


I have what I suspect to be a simple question and after search I suspect the answer to my question to be no, but to double check...

Is it possible to use the Jquery ui dialog with out setting up a DIV?

ie rather than..

$(function() { $( "#dialog" ).dialog();});...

<div id="dialog" title="Do I really need this?">This is a lot of typing just to pass on a simple message</div>

Is it possible just to have something like...

$(function(quickly) { $( "#dialog" ).dialog('this would be much easier');});...

and call it with a quickly() type thing when needed.

You may note that I muddle may way through Javascript and do my best through trial and error to hit on a solution that works for me.

I suppose, I'm asking if I can somehow use dialog in a similar fashion to...

alert("this is simple")

...so I can call an alert to the user whenever I need to, rather than on url click or button press.

Hopefully the above make sense and I'll suspect I'll have to stick with the ugly standard alert but do let me know if there is a simple solution.

Thanks

解决方案

I hope this helps somebody, you can pass html to dialog directly, like this:

$("<p>Hello World!</p>").dialog(); 

so this way you don't have to have a pre-builded div, you could use:

$("<div>My div content</div>").dialog();

EDIT: changed end tag to </div> instead of </p>

这篇关于Jquery-UI对话框 - 飞行中没有DIV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆