Detect click event inside iframe

前端 未结 9 2182
刺人心
刺人心 2020-11-28 05:40

I\'m writing a plugin for TinyMCE and have a problem with detecting click events inside an iframe.

From my search I\'ve come up with this:

Loading iframe:

9条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-28 06:14

    I solved it by doing like this:

    $('#filecontainer').load(function(){
    
            var iframe = $('#filecontainer').contents();
    
            iframe.find("#choose_pics").click(function(){
                   alert("test");
            });
    });
    

提交回复
热议问题