kramden88
kramden88

Reputation: 25449

Call JQuery Function OnClick

I know this question looks very similar to other questions on this site but I'm in a particular situation and I can't for the life of me figure out how to get this to work. Perhaps it's simple but I can't figure it out. This is my basic dialog function that I want to call onclick with an "a" tag:

<script>
     $('<iframe src="hyperlink" id="tag" frameBorder="0" width="98%" />').dialog({
          autoOpen:false,
          title: 'Documents',
          modal:true,
          autoResize:true,
          resizable:false,
          width: 900,
          height: 400,
          draggable:false,
          open: function(){
               $(this).css('width','98%'
               );
          }
     });

I know using iframes isn't preferable but there's a very specific reason that this is the only way it will work. Apart from that, how could I get a tex to call this dialog box onclick?

Upvotes: 1

Views: 2903

Answers (1)

James Montagne
James Montagne

Reputation: 78780

This should work

$("a#thelink").click(function(){
   $("#tag").dialog('open');
});

where thelink is the ID of your link.

Upvotes: 1

Related Questions