IE and ContentEditable Attribute

ByTrent Jones

IE and ContentEditable Attribute

Ran into an issue today using jQuery with IE and setting ContentEditable=’true’ on a click command. First I created a div with ContentEditable set to true without jquery and ran it in IE. Ok, it’s working. Now to try and add the attribute dynamically. I removed the attribute and replaced it with this bit of javascript:

$(function(){
$("#test").click(function() {
$(this).attr({ ContentEditable: "true" });
});
});

This did not work. Even though IE would allow the Cap “C” to set to true without jQuery, it would not work in doing so dynamically. Changing to:

$(function(){
$("#test").click(function() {
$(this).attr({ contentEditable: "true" });
});
});

Works perfectly.

About the Author

Trent Jones administrator