JQuery and frames - $(document).ready doesn't work

后端 未结 12 2360
长发绾君心
长发绾君心 2020-12-14 09:51

I have a page, with some code in js and jQuery and it works very well. But unfortunately, all my site is very very old, and uses frames. So when I loaded my page inside a fr

12条回答
  •  眼角桃花
    2020-12-14 10:14

    No need to modify the markup. Just fix the selector. It should be:

    $("frame[name='main']").ready(function(){..}); 
    

    not

    $("#frameName").ready(function(){..}); 
    

    Note: it seems the jQuery ready event fires multiple times. Make sure that is OK with your logic.

提交回复
热议问题