简体   繁体   中英

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?

This should work

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

where thelink is the ID of your link.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM