Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using jquery to apply and remove different styles. The first link removes any existing styles and wrap the content in an unordered list. The third

Using jquery to apply and remove different styles. The first link removes any existing styles and wrap the content in an unordered list. The third link removes any applied styles and returns to the default state.The second link should remove any existing styles and wrap the content in an ordered list.

The second link is not working, and I can't figure out why as the syntax works for the first one. Any suggestions? All of code included below. Change Text Formatting part 2

$(document).ready(function() { //format to unordered list $("#bullets").click(function(event) { event.preventDefault(); if(this.id == "bullets") { $("#list").unwrap(); $("span").unwrap(); } $("#list").wrap("

    "); $("span").wrap("
  • "); }); //format to ordered list $("#ordered").click(function(event) { event.preventDefault(); if(this.id == "ordered") { $("#list").unwrap(); $("span").unwrap(); } $("#list").wrap("
      "); $("span").wrap("
    1. "); }); //remove formatting $("#remove").click(function(event) { event.preventDefault(); $("#list").unwrap(); $("span").unwrap(); }); });

      My favorite book series is the "Harry Potter" series by J.K. Rowling. There are a total of seven books in the main series, with a handful of short stories and extras published.

      Here are the titles of the seven books:

      Add bullets Add numbers Remove Formatting

      Harry Potter and the Sorcerer's Stone Harry Potter and the Chamber of Secrets Harry Potter and the Prisoner of Azkaban Harry Potter and the Goblet of Fire Harry Potter and the Order of the Phoenix Harry Potter and the Half-Blood Prince Harry Potter and the Deathly Hallows

    2. Step by Step Solution

      There are 3 Steps involved in it

      Step: 1

      blur-text-image

      Get Instant Access to Expert-Tailored Solutions

      See step-by-step solutions with expert insights and AI powered tools for academic success

      Step: 2

      blur-text-image

      Step: 3

      blur-text-image

      Ace Your Homework with AI

      Get the answers you need in no time with our AI-driven, step-by-step assistance

      Get Started

      Recommended Textbook for

      Combinatorial Testing In Cloud Computing

      Authors: Wei-Tek Tsai ,Guanqiu Qi

      1st Edition

      9811044805, 978-9811044809

      More Books

      Students also viewed these Programming questions