--- id: 564944c91be2204b269d51e3 title: Change Text Inside an Element Using jQuery challengeType: 6 --- ## Description
Using jQuery, you can change the text between the start and end tags of an element. You can even change HTML markup. jQuery has a function called .html() that lets you add HTML tags and text within an element. Any content previously within the element will be completely replaced with the content you provide using this function. Here's how you would rewrite and emphasize the text of our heading: $("h3").html("<em>jQuery Playground</em>"); jQuery also has a similar function called .text() that only alters text without adding tags. In other words, this function will not evaluate any HTML tags passed to it, but will instead treat it as the text you want to replace the existing content with. Change the button with id target4 by emphasizing its text. Check this link to know more on the difference between <i> and <em> and their uses. Note that while the <i> tag has traditionally been used to emphasize text, it has since been coopted for use as a tag for icons. The <em> tag is now widely accepted as the tag for emphasis. Either will work for this challenge.
## Instructions
## Tests
```yml tests: - text: Emphasize the text in your target4 button by adding HTML tags. testString: assert.isTrue((/|\s*#target4\s*<\/em>|<\/i>/gi).test($("#target4").html()), 'Emphasize the text in your target4 button by adding HTML tags.'); - text: Make sure the text is otherwise unchanged. testString: assert($("#target4") && $("#target4").text().trim() === '#target4', 'Make sure the text is otherwise unchanged.'); - text: Do not alter any other text. testString: assert.isFalse((/|/gi).test($("h3").html()), 'Do not alter any other text.'); - text: Make sure you are using .html() and not .text(). testString: assert(code.match(/\.html\(/g), 'Make sure you are using .html() and not .text().'); - text: Make sure to select button id="target4" with jQuery. testString: assert(code.match(/\$\(\s*?(\"|\')#target4(\"|\')\s*?\)\.html\(/), 'Make sure to select button id="target4" with jQuery.'); ```
## Challenge Seed
```html

jQuery Playground

#left-well

#right-well

```
## Solution
```html

jQuery Playground

#left-well

#right-well

```