Reputation: 1111
I'm currently using jquery .html
for DOM insertion. Is there a way I can insert multiple elements?
So far I have tried using &&
or even using a comma inserting multiple elements but none of them seems to be feasible. Separating it would also likely not work.
$('#header .aim-breadcrumbs').html($('.layout-container .region-breadcrumb') && $('#header .aim-nav .connect'));
$('#header .aim-breadcrumbs').html($('.layout-container .region-breadcrumb', '#header .aim-nav .connect');
$('#header .aim-breadcrumbs').html($('.layout-container .region-breadcrumb');
$('#header .aim-breadcrumbs').html($('#header .aim-nav .connect');
Upvotes: 0
Views: 528
Reputation: 2841
You are really close. You just need to put the comma inside your selector string. Don't use two strings.
$('#header .aim-breadcrumbs').html($('.layout-container .region-breadcrumb, #header .aim-nav .connect'));
This will work, but as everyone is already shouting, .append
is the typical way of doing this.
$('#header .aim-breadcrumbs').append($('.layout-container .region-breadcrumb, #header .aim-nav .connect'));
Upvotes: 3