开发者

find all div's with contenteditable attribute in iframe and remove said attribute with jQuery?

I have an ifram on a page with class ms-dlgFrame and in开发者_如何转开发 this iframe I want to remove contenteditable="true" on elements since it's not supported by Safari on iPad (I am checking the user agent first).

I have some issues with combining .find(), .each(), .attr(), and .removeAttr()

I tried something like:

console.log("iPad");
$('.ms-dlgFrame').contents().find("div").attr("contenteditable").each(function() {
    $(this).removeAttr("contenteditable");

});

Any ideas?

Thanks in advance.


Try the selector div[contenteditable='true'] and drop the attr() call from your chain:

console.log("iPad");
$('.ms-dlgFrame').contents().find("div[contenteditable='true']").each(function() {
    $(this).removeAttr("contenteditable");
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜