我現有的div元素這樣的標籤:插入內容使用JQuery .append()函數
<div class="tab-pane fade active in" id="tab-a">
</div>
我用這個插入JavaScript字符串數組到該標籤:
var full_list = "";
for (var i = 0; i < data.length; ++i) {
full_list = '<a href="#' + data[i].alias + '">' + full_list + data[i].name + '<br>';
}"</a>"
$(target).html(full_list);
和我內容被垂直地顯示在單個列是這樣的:
Dairy products
Dancing Groups
Dancing Instructors
Data Communication Services
Data Networking & Cabling
Data Processing Equipment
Day Care/Montessori Schools
我希望他們在兩列這樣的顯示作爲:
Dairy products Data Networking & Cabling
Dancing Groups Data Processing Equipment
Dancing Instructors Day Care/Montessori Schools
Data Communication Services
我該如何做到這一點?
在div中使用帶tr td的表 – Niladri
您確定要將以前的所有'full_list'值更換爲僅在for循環外部添加一次的'' tags? And why is ''嗎? –
我想用
– jsb1001