I'm trying to insert a <br/> in the text
I'm trying to move the button under the textarea
from js-code. But I can't make it happen!
var mybr = document.createElement('br');
var targetInnerHtml = obj.innerHTML;
var textArea= document.createElement('textarea');
var parentnode = obj.parentNode;
parentnode.insertBefore(textArea, obj);
parentnode.insertBefore(textArea, obj);
parentnode.insertBefore(mybr,obj.nextSibling); //this is not working either...
// document.write('<br />'); //tried this but nothing
//parentnode.appendChild(mybr); 开发者_如何学运维//this either
parentnode.insertBefore(butt, obj);
Any idea why?
I haven't got time to test, right now, but can you not simply set the display
of the textarea
to block
:
textarea.style.disply = 'block';
JS Fiddle demo.
just put your textarea inside a div so it will occupy the whole line
精彩评论