jQuery清除后如何关注iframe的内容
我目前有一个所见即所得的iframe,用户可以将输入提交到页面上的其他区域。 提交iframe输入后,我将其设置为清除内容。 我还想自动重点关注iframe。
这是我目前的代码:
postContentClr = $("iframe#textarea1IFrame").contents().find("body") postContentClr.html(" ").focus();
弄清楚了。 我不得不只关注父母。 而且Jitter是正确的,因为我已经将它声明为jQuery对象,所以它不需要包装。
工作代码:
postContentClr = $("iframe#textarea1IFrame").contents().find("body") postContentClr.html("").parent().focus();
我不确定我理解你要做什么,但postContentClr
是一个jQuery对象,所以调用html()
要求你通过jQuery访问它,如下所示:
$(postContentClr).html('').focus();