Convert jquery code to native js code

window.parent.$ (".clildFrame .layui-tab-item.layui-show"). Find ("iframe") [0] .setAttribute ("src", href);

how is this code written in native js? Hope to be compatible with IE8. PS:document.getElementsByClassName does not support IE8-sharp-sharp-sharp problem description

Jun.09,2021

var parent = window.parent

parent.document.getElementsByTagName('div') //classNameclass,iframe

var arr = [],_dom = document.getElementsByTagName('*');
for(var i=0;i<_dom.length;iPP){
    if(_dom[i].className == 'opts-group') arr.push(_dom[i])
}

Select all nodes. And then traverse. Determine whether their class meets the requirements. Save it if it fits. What you need is to find iframe and then do the operation, so you don't need to save it, just OK it directly.

clipboard.png

Menu