I have problem with this piece of code:
var el = $('div#editor');
el.find('*[contentEditable]').removeAttr('contentEditable');
It works great in Chrome 4/5/6, but it doesn’t work in FF (3.6.) or Opera (10.60).
In FF it throws this exception:
Error: uncaught exception: [Exception… “An invalid or illegal string was specified” code: “12” nsresult: “0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)” location: “http://www.www.com/js/script.js Line: 51″]
Does anybody have an idea why this is happening and how to fix it ?
Right now I am using this fix, but it’s not clean solution, because it leaves contentEditable attribute and I have to clean it up on server side:
try {
el.find('*[contentEditable]').removeAttr('contentEditable');
} catch (e) {
el.find('*[contentEditable]').attr('contentEditable', false);
}
works fine to me…
html
jQuery
maybe try all small letters on
contenteditableand remove*on$('*[contenteditable]')demo
tested on FF (3.6.) or Opera (10.10).