我有这段代码,我需要对前 2 个对象做一些事情,然后对其余的做一些事情,但是如何做呢?我从<tr data-name='test' data-price='2' data-one='blabla' ...
data = $(this).data();
html_option = "<table id='Unit_Options_Table'>";
// Do some thing with the first 2
$.each(data, function(option, cost) { // Then do something with the rest
html_option += "<tr>" +
"<td class='Unit_Options_Name_td'>" + option + "</td>" +
"<td class='Unit_Options_Cost_td'>" + cost + "</td>" +
"</tr>";
});
html_option += "</table>";