Change Text Inside an Element Using jQury

Change Text Inside an Element Using jQury
0.0 0

#1

Change Text Inside an Element Using jQuery

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

I don’t understand what this means? I saw no change in the app screen.
Could anyone help me understand what em means and what exactly this piece of code is doing to the app? Thank you.


#2

Using the .html method in jQuery you can include HTML elements instead of purely text.

In this instance, the text is wrapped in <em> tags, which are used to italicize the content found in between tags.

The difference is subtle but is the same difference visible in this simple example:

  • this is plain text, and it is not italicized

  • this text is wrapped in <em> tags and it is therefore itailcized.


#3

Thanks alot for the quick response :smile:


#4

Glad to be of some assistance :slight_smile: