JavaScript函数的等效jQuery函数

Equivalent jQuery function of a javascript function

本文关键字:函数 jQuery JavaScript      更新时间:2023-09-26

哪个是这个javascript函数的等效jQuery函数?这是在基于 iframe(id='editor')和文本区域(id='text')的文本编辑器上下文中。

function edit(){
edition = document.getElementById("editor").contentWindow;
HTMLcontent = edition.document.getElementsByTagName('body')[0];
HTMLcontent.innerHTML = document.getElementById('text').value;
}

在Jquery中,代码是这样的:

bodyIframe = $("#editor").contents().find("body")[0];
bodyIframe.html($("#text").val());