freeCodeCamp Challenge Guide: Change Text Inside an Element Using jQuery

freeCodeCamp Challenge Guide: Change Text Inside an Element Using jQuery
0

#1

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 italicize the text of our heading:

$("h3").html("<em>jQuery Funhouse</em>");

jQuery also has a similar function called .text() that only alters text without adding tags. So when using .html() please remember that you will be editing the whole markup and not just the text.


#2

$("#target4").html(button id=“target4”);

Why is this telling me I’m missing a ) after argument list. Where would I put another )
?


#3

Here is the answer:
$("#target4").html("#target4");

remember about < em > < / em > in the second part


#4

$("#target4").html("#target4");

dont forget to add tags


#5

if you don’t mind i asking where shall we put those tags can anyone show us the proper code


#6

what is the right code


#7

GOT THE RIGHT CODE!!!
$("#target4").html("#target4");


#8
$("#target4").html("<em>#target4</em>");

#9

Here is the correct answer


#10

Thank you for the answer!
If you can, can you please further explain the < em > tags and how I would use them later down the road? Thank you.


#11

remove all spaces inside the function .html() and it will work


#12

it does not work :frowning:


#13

Here is the answer! $("#target4").html("#target4");