append element in head of an iframe using jquery

后端 未结 4 1747
刺人心
刺人心 2021-01-17 23:21

i want to append a style sheet(css) link to the head of an iframe using jquery . i tried with the following code but not working.

$(\'#tabsFrame\').contents(         


        
4条回答
  •  余生分开走
    2021-01-18 00:15

    i am used to append data to an iframe by using this line of code

    $('body', window.frames[target].document).append(data);

    In your case, this line would look like this

    $('head', window.frames['tabsFrame'].document).append(cssLink);

    EDIT:

    Add to the iframe and change your var cssLink to

    cssLink = '

提交回复
热议问题