admin管理员组文章数量:1289425
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 bining .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.
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 bining .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.
Share Improve this question edited Dec 13, 2012 at 14:20 Michael Berkowski 271k47 gold badges450 silver badges393 bronze badges asked Jun 30, 2011 at 2:08 johnjohn 531 silver badge6 bronze badges1 Answer
Reset to default 10Try 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");
});
本文标签:
版权声明:本文标题:javascript - find all div's with contenteditable attribute in iframe and remove said attribute with jQuery? - Stack Over 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741449454a2379400.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论