当用户忘记输入值但我不确定如何执行此操作时,我想将光标聚焦在jwysiwyg iframe中。有人可以帮忙吗?
答案 0 :(得分:1)
首先,没有通过javascript移动鼠标的机制。
要关注iframe,请使用此脚本(如果使用jquery)
$(".wysiwyg").find("iframe").focus();
要访问iframe的内容,您必须使用上述脚本:
$(document).ready(function(){
$(".wysiwyg").find("iframe").load(function(){
var test = $(".wysiwyg").find("iframe").contents().find('body').html();
//do job with the content.
//Remember that jwysiwyg will produse some code even if it seems there is
//nothing.(couse the wysiwyg is base on browser behavor
});
});