When i try to given below code for change margin-bottom
of selected multiple line, at that time only last selected line was change other line just add p tag but not the style. May be i can not focus all selected line.I tried below code for this.
Javascript:
var selectedElement = null;
function singleline() {
document.execCommand('formatblock',false,'p')
selectedElement1 = window.getSelection().focusNode.parentNode;
selectedElement1.style.marginBottom = '10px';
}
HTML:
<input type="button" value="addMarginBottom" onclick="javascript:singleline();"/>
<div class="textcontent" contenteditable="true"></div>
My problem is: How can i focus all selected node and add this style?