Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function createBook() {
- let id = 1;
- return function (selector, title, author, isbn) {
- let text = '';
- let divid = 'book' + id;
- text +='<div id="' + divid + '" style="border: medium none;">';
- text += '<p class="title">' + title + '</p>';
- text += '<p class="author">' + author + '</p>';
- text += '<p class="isbn">' + isbn + '</p>';
- text += '<button id="select">Select</button>';
- text += '<button id="deselect">Deselect</button>';
- text += '</div>';
- id++;
- $(selector).html(text);
- let selectButton = $('#select');
- let deselectButton = $('button:contains("Deselect")');
- $('#select').click(function (event) {
- $('#'+divid).css("border", "2px solid blue")
- });
- $('#deselect').click(function (event) {
- $('#'+divid).css("border", "none")
- });
- }
- })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement