简体   繁体   中英

send value from textarea

hello i have the following script : http://jsfiddle.net/EFjcA/

i would like my function :

var saveEdit = function(event2){
    var btn = event2.target,
        li  = btn.parentNode,
        p   = li.getElementsByClassName('paratext')[0],
        te  = p.parentNode;

    te.style.display="none";
    p.appendChild(te.value);
    p.style.display="block";
    btn.innerText = "Edit";
    btn.onclick = makeAreaEditable;
};

..to save the value from inside the textarea and display it after the button Ok is pressed.

Please replace the line

p.appendChild(te.value);

into

p.innerText = te.value;
li.appendChild(p);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM