gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 04:17:32 25 4
gpt4 key购买 nike

例如:

我点击一个按钮。 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com