I need to create two objects separately, and then add one by one and return the combined object from the function. My requirement is that I have to add this object outside the function, and the function should return 2 created objects as one. See code below. it returns only div. no table?
function html() {
var _tab = $("<table>").attr("id", "table_1")
var _div = $("<div>").attr("id", "div_1").text("test");
return _div.after(_tab);
}
$("body").append(html());
source
share