Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Summary</title>
- <script src="jquery-1.10.2.js"></script>
- </head>
- <body>
- <div class="wrapper">
- <div id="content">
- <p><strong>The Theodor Pallady Museum </strong>is a museum situated in one of the oldest surviving merchant
- houses in Bucharest, Romania. It <strong>includes many works by the </strong>well-known Romanian <strong>painter
- Theodor Pallady</strong>, as well as a number of European and Oriental furniture pieces.</p>
- </div>
- <input type="button" id="generate" value="Generate Summary"/>
- </div>
- <script>
- $(() => generateSummary('#generate'));
- </script>
- <script>
- function generateSummary(selector) {
- $(selector).on('click', function () {
- let strongText = $('#content strong').text();
- createSummary(strongText);
- });
- function createSummary(strongText) {
- let summary = $('<div>');
- summary.attr('id', 'summary')
- let heading = $('<h2>').text('Summary');
- let paragraph = $('<p>').text(strongText);
- summary.append(heading);
- summary.append(paragraph);
- let parent = $('#content').parent();
- parent.append(summary);
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement