JSFiddle - React, Tailwind, and code Playground

by Ryan Neufeld

JavaScript

$(".add-book-container .btn-primary-sm").live('click', function(e){
        var book = $(this).parents(".add-book-container").find(".list li"),
        cover_url = book.find('img').attr('src').replace('thumbs/', ''),
        sect = $(this).parents(".add-book-container").find("section"),
        subjectCode = sect.data('subjectcode'),
        catalogNumber = sect.data('catalognumber');  //THIS SHOULD BE A COMMA!!!
        courseId = subjectCode+'-'+catalogNumber,
        isbn = book.data('isbn'),
        ean = book.data('ean'),
        course = $('#'+courseId),
        item = $('<li class="book" style="display: none;"><a href="#" class="cover"><img class="thumb" alt="" src="'+cover_url+'" /></a></li>'),
        overlay = $('<img class="overlay" src="/a/i/prototype/book-overlay.png" style="display: none;" />');

                                                                     
                                                                     
    item.data('isbn', isbn); //this is where IE9 gives this error: Object doesn't support property or method 'data'
    item.data('ean', ean);
    item.find(".cover").append(overlay);
    item.find(".cover .thumb").load(function(){
      item.find(".cover").css({
        width: $(this).width()+"px",
        height: $(this).height()+"px",
      });

      item.find(".overlay").show();
    });

    course.find(".objects .actions").before(item);
    makeDraggable(item);
    item.fadeIn();
  });