Skip to content Skip to sidebar Skip to footer

Concat Two Html Elements

Solution 1:

You can use .add() - not a concatenation operator because those are jQuery objects not strings

var bread =  $('<li/>').html($('<a/>',{href: '#',text: 'Alle',click: function(){Diagnose.start()} }));
bread = bread.add($('<li/>').html($('<a/>',{href: '#',text: data['icd1'].nummer,click: function(){Diagnose.icd(2,data['icd1'].id)} })));

$('#side-panel2 .breadcrumb').empty().append(bread);

Solution 2:

In short, in general:

$(".container").append( $("<a>A</a>"), $("<a>B</a>") );

Take a look on this DEMO.

Post a Comment for "Concat Two Html Elements"