0

I am trying to add more spaces between words.

I retrieved the record from ajax. I just want to add it on the combo box. But I need to make space between words. But It doesn't make as I expect

Jquery Code

for (var i = 0; i < data.d.length; i++) {
    $('#ComboChangeAccNo').append($('<option>', {
        value: data.d[i].seqNo,
        text: data.d[i].Name + '                 ' + data.d[i].RollNo+ '                ' + data.d[i].RollID + '              ' + data.d[i].accNo + '             ' + data.d[i].seqNo + '             ' + data.d[i].amount + '                ' + data.d[i].amountType
    }));
    console.log("Data 0 =" + data.d[i].seqNo);
}

It is printing without space. I tried like below also. It considers as text instead of html

text: data.d[i].Name + '&nbsp;&nbsp;' + data.d[i].RollNo+ '&nbsp;&nbsp;' + data.d[i].RollID + '&nbsp;&nbsp;' + data.d[i].accNo + '&nbsp;&nbsp;' + data.d[i].seqNo + '&nbsp;&nbsp;' + data.d[i].amount + '&nbsp;&nbsp;' + data.d[i].amountType
Liam neesan
  • 2,282
  • 6
  • 33
  • 72

1 Answers1

1

There is a similar question asked before here. You can find the answer at How to create string with multiple spaces in JavaScript

Raj919_ui
  • 34
  • 4
  • PS: I am new to stack overflow and not able to add the duplicate flag, that's why provided the reference link as an answer. Correct me if it is not the right way to referencing an already asked question. Thanks! – Raj919_ui Jan 03 '19 at 22:41