大佬教程收集整理的这篇文章主要介绍了Jquery在iframe中检测body标签上的更改或keyup,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<div id="this_is_our_div_Container"> <div class="wysiwyg"> <iframe id="f_Body-wysiwyg-iframe"> <html> <body style="margin: 0;" class="wysiwyg"> I just typed this Now!</body></html> </iframe> </div> <textarea class="wysiwyg" cols="20" id="f_Body" name="f_Body" rows="2" style="display: none;"></textarea> </div>@H_874_5@看到body标签包含实时更改. @H_874_5@有了这些SO问题…… @H_874_5@jQuery ‘if .change() or .keyup()’ @H_874_5@https://stackoverflow.com/a/1639342/511438 @H_874_5@我在文档中尝试了以下内容.准备: @H_874_5@
$('iframe').contents().find('body.wysiwyg').live('change',function (E) { alert('tesTing'); }); $('iframe').contents().find('body.wysiwyg').live('keyup',function (E) { alert('tesTing'); }); $('iframe > *').bind('keyup',function (E) { alert('tesTing'); });@H_874_5@希望这个版画屏幕有用.
$('elementSELEctor',$('iframeSELEctor').contents()).on('keyup',function(E) { alert('tesTing'); });@H_874_5@所以在你的情况下,我想: @H_874_5@
$('body.wysiwyg',$('iframe#f_Body-wysiwyg-iframe').contents()).on('keyup',function(E) { alert('tesTing'); });@H_874_5@尽管使用此答案中的代码取决于使用version 1.7 or higher of jQuery. @H_874_5@如果您使用的是旧版本的jQuery,则可以使用从版本1.7开始不推荐使用的live,也可以使用委托.我不太确定.你最好的选择可能是使用最新版本的jQuery与.on()和.off().
以上是大佬教程为你收集整理的Jquery在iframe中检测body标签上的更改或keyup全部内容,希望文章能够帮你解决Jquery在iframe中检测body标签上的更改或keyup所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。