Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
javascript函数的等效jQuery函数_Javascript_Jquery_Function_Text_Editor - Fatal编程技术网

javascript函数的等效jQuery函数

javascript函数的等效jQuery函数,javascript,jquery,function,text,editor,Javascript,Jquery,Function,Text,Editor,哪个jQuery函数与此javascript函数等效?这是在基于iframe(id='editor')和textarea(id='text')的文本编辑器的上下文中 在Jquery中,代码如下所示: bodyIframe = $("#editor").contents().find("body")[0]; bodyIframe.html($("#text").val()); $(“#编辑器#文本”).html();或$('#editor').find('#text').html();jQuer

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


在Jquery中,代码如下所示:

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

$(“#编辑器#文本”).html();或$('#editor').find('#text').html();jQuery是javascript,您可以按原样使用它!在您的例子中-htmlObj是一个本地DOM元素,而不是jQuery对象-因此它没有
.html()
方法-并且您缺少一个右括号htmlObj只是一个名称-这是什么
htmlObj=$(“#编辑器”).contents().find(“body”)[0]
$(“#编辑器”).contents().find(“body”)
==jQuery对象和
$(“#编辑器”).contents().find(“body”)[0]
==DOM元素现在我明白你的意思了,可能我们在deiframe中没有jQuery,那么它应该是这样的:`bodyIframe.innerHTML=$(“#text”).val()`谢谢,为什么这个例子有效?
bodyIframe = $("#editor").contents().find("body")[0];
bodyIframe.html($("#text").val());