Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function createBook(comDiv, title, author, isbn) {
  2.     let num = 1
  3.     let div = $(`<div>`)
  4.     div.attr('id', `book${num}`)
  5.        
  6.     let tit = $(`<p class='title'>${title}</p>`)
  7.     let aut = $(`<p class="author">${author}</p>`)
  8.     let id = $(`<p class="isbn">${isbn}</p>`)
  9.  
  10.     tit.appendTo(div)
  11.     aut.appendTo(div)
  12.     id.appendTo(div)
  13.     let select = $('<button>')
  14.         .text('Select')
  15.     select.appendTo(div)
  16.     let deselect = $('<button>')
  17.         .text('Deselect')
  18.     deselect.appendTo(div)
  19.     div.appendTo(comDiv);
  20.     select.click(() => {
  21.         div.attr('style', 'border: 2px solid blue')
  22.  
  23.     })
  24.     deselect.click(() => {
  25.         div.attr('style', 'border: medium none')
  26.     })
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement