Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
27
rated 0 times [  34] [ 7]  / answers: 1 / hits: 31401  / 8 Years ago, wed, february 3, 2016, 12:00:00

So I'm currently creating a dynamic table using some JavaScript and a set of objects. I need to add in some white space between the two but one space isn't enough, I need to have it almost tabbed out. What would be the best way to do this? Here is my code for it so far:



var sections = {

p1 : {sname: Dynamic Table, mscore: 20},
p2 : {sname: IntelliJ Usage, mscore: 10},
p3 : {sname: Calender Control, mscore: 30},
p4 : {sname: Active Form, mscore: 20},
p5 : {sname: Object Database, mscore: 20}
};

document.write(Object.keys(sections).reduce(function(s, p, i) {
var o = sections[p];
return s + (i>0?'<br><br><br><br>':'') + o.sname + ' ' + o.mscore + ' ' }, '')
);

More From » html

 Answers
25

If you want to add whitespace to the DOM, try using a nonbreaking space



'&nbsp;'


instead of



' '


These nonbreaking spaces can be chained.



&nbsp;&nbsp;


would force two spaces to be displayed on the page.


[#63454] Monday, February 1, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dequant

Total Points: 88
Total Questions: 99
Total Answers: 95

Location: Ukraine
Member since Sun, Dec 13, 2020
4 Years ago
dequant questions
;