Manan
Manan

Reputation: 11

calling jquery from a javascript function

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

</script>

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

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

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

Thanks

Upvotes: -1

Views: 202

Answers (1)

Nick Craver
Nick Craver

Reputation: 630349

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

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

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

Upvotes: 3

Related Questions