Home > Dont Forget, Tips and Tricks > IE and ContentEditable Attribute

IE and ContentEditable Attribute

September 1st, 2009

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.

Dont Forget, Tips and Tricks

  1. No comments yet.
  1. No trackbacks yet.