从javascript函数调用jquery [英] calling jquery from a javascript function

查看:86
本文介绍了从javascript函数调用jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<html>
<head>
<script type="text/javascript">
function display(id)
{
  // open jquery modal window using jquery UI 
}

</script>

</head>
<body>
</body>
</html>

每当使用常规javascript函数调用调用函数显示时,我都想使用jquery UI打开jquery模态窗口.

I want to open jquery modal window using jquery UI whenever the function display is called using normal javascript function call .

我可以使用jquery UI的.diolog函数,但是如何从javascript函数中调用它?

I can use .diolog function of jquery UI , but how to call it from within javascript function ?

谢谢

推荐答案

您可以使用选择器并调用.dialog(),如下所示:

You can just use a selector and call .dialog(), like this:

function display(id)
{
  $("#"+id).dialog();
}

这会将传递的id用于 #ID选择器,然后仅调用<该元素的href ="http://jqueryui.com/demos/dialog/" rel ="nofollow"> .dialog() .

This uses the passed id for the #ID selector then just calls .dialog() for that element.

这篇关于从javascript函数调用jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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