jquery - 如何使用 jQuery 在 iF​​rame 中执行 "execCommand"?

标签 jquery iframe execcommand

例如:

我点击一个按钮。 div 正在改变一些东西

$('#change').click(function(){ //the button
  $('#myframe').contents().find('#makeit').css("do Someting") //the div in a frame
});

到目前为止我已经明白了。

我需要知道,如何执行 execCommand (可能像“bold”)而不是 .css() 方法?

最佳答案

我找到了答案here .

就我而言(jQuery)。看起来像

$('#change').click(function(){
   document.getElementById("myframe").contentWindow.document.execCommand('bold', false, null);
});

关于jquery - 如何使用 jQuery 在 iF​​rame 中执行 "execCommand"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13583124/

相关文章:

jquery - 如何正确克隆(jQuery)通过 PIE 应用样式的元素?

javascript - 从父窗口到 2 层嵌套 iframe 的事件监听器可能吗?

javascript - 检查选择是否包含链接

javascript - 使用 execCommand 设置 anchor 名称

javascript - 在 jquery 中使用 hasClass 未检测到内部类名称

javascript - 从 Action 类将 json 返回到 ajax

html - 保护 iFrame - 只允许它在一个域上工作

javascript - 阻止用户在 Iframe 中导航

javascript - execCommand ('copy' ) 无法以编程方式工作,仅当通过 DevTools 控制台执行时

jquery - 使用 jQuery 重命名 jQuery UI 选项卡