(function ($) { AblePlayer.prototype.populateChaptersDiv = function() { var headingLevel, headingType, headingId, $chaptersHeading, $chaptersList; if ($('#' + this.chaptersDivLocation)) { this.$chaptersDiv = $('#' + this.chaptersDivLocation); this.$chaptersDiv.addClass('able-chapters-div'); // add optional header if (this.chaptersTitle) { headingLevel = this.getNextHeadingLevel(this.$chaptersDiv); headingType = 'h' + headingLevel.toString(); headingId = this.mediaId + '-chapters-heading'; $chaptersHeading = $('<' + headingType + '>', { 'class': 'able-chapters-heading', 'id': headingId }).text(this.chaptersTitle); this.$chaptersDiv.append($chaptersHeading); } this.$chaptersNav = $('