I want to inject certain html snippet with JQuery into existing html page. Existing snippet:
<table class="course hoverHighlight">
<tbody>...</tbody>
...
</table>
I want to inject:
<thead>
<tr>
<th class="title">Course</th>
<th class="author">Author</th>
<th class="level">Level</th>
<th class="rating">Rating</th>
<th class="duration">Duration</th>
<th class="releaseDate">Released</th>
</tr>
</thead>
before tbody tag.
<table class="course hoverHighlight">
<thead>...</thead>
<tbody>...</tbody>
</table>
I have tried this code but it didn`t work:
function() {
var theadInjection= $("<thead>
<tr>
<th class="title">course</th>
<th class="author">author</th>
<th class="level">level</th>
<th class="rating">rating</th>
<th class="duration">duration</th>
<th class="releasedate">released</th>
</tr>
</thead>");
$( '.course' ).prepend(theadInjection);
}
Simple injection like this one did work:
function() {
var theadInjection= $("<thead></thead>");
$( '.course' ).prepend(theadInjection);
Thanks.