javascript - Value of an html element edited -


why code not work in firefox? goal edited value when element loses focus

out = document.getelementbyid('out');  edit = function(e) {    var element = e;    element.contenteditable = true;    element.onblur = function(blur) {      console.log(element.innertext);      out.innertext = element.innertext;    };  };
span {    background-color: cyan;  }  #out {    background-color: yellow;    padding: 0.5em;  }
<span ondblclick="edit(this)" data-foo="foo" data-bar="bar">      double-click , edit-me</span>    <p></p>  <span id="out"></span>

firefox doesn't support .innertext. should use w3 standard .textcontent instead.

this work in modern browsers , can patched ie8 if needed.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -