Code is here http://jsfiddle.net/Ea7hd/1/
Basically my output needs to match the indentation of the html elements as they appear in the textarea.
The problem is that when I am looping through all the elements in the textarea I have no way of adding proper indentation because the I have no way of setting where one element is in relation to its parent.
You can use <div>
with padding-left
: http://jsfiddle.net/Ea7hd/5/ .
Identation, padding and margin are styles, so you should achieve them trough CSS, so you shouldn't do it adding
.
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.