Jump to content

document.body.contentEditable=!document.body.isContentEditable;


10 weber

Recommended Posts

I added a new javascript link to my bookmarks toolbar, that turns the body element editable on the first click, and back to normal on the second:javascript:document.body.contentEditable = !document.body.isContentEditable; void(0);It works great on the first click, but in FF the second doesn't do anything. Why?

Link to comment
Share on other sites

Look closely. You're using different names for the property. Since .isContentEditable doesn't exist, doing a ! returns true. Since that isn't the property you're changing, it always returns true. So you only have the illusion that it works the first time. The result is what you want, but the technique is broken.BTW, void(0) does nothing, so there's no point in having it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...