Reputation: 7625
I have a data table with data from a JSON file.
I filtered the data and generated an HTML string that I need prepended to this
<div class='toolbar'>
I am having issues with prepending it.
$(document).find(cleanKey).prepend(htmlString) // didnt work
$('#' + key.toLowerCase().replace(/\s/g, "-") + '-table').prepend(htmlString) // didnt work
Upvotes: 0
Views: 35
Reputation: 3068
You can append a string with the following:
$('#' + key.toLowerCase().replace(/\s/g, "-") + '-table').html() += htmlString;
Upvotes: 0
Reputation: 4945
Are you prepending or appending?
Prepend
$('.toolbar').prepend(htmlString);
Append
$('.toolbar').append(htmlString);
Upvotes: 1