daremkd
daremkd

Reputation: 8424

jQuery inserting double quotes

I have this simple jQuery code:

$("p").html("A simple <strong>example</strong>");

And when I inspect this using Chrome, I get:

<p>
  "A simple "
  <strong>example</strong>
</p>

Why are there double quotes here? Why don't I simply get:

<p>A simple </strong>example</strong></p>

Upvotes: 0

Views: 57

Answers (3)

Amar Singh
Amar Singh

Reputation: 5622

try using .append()

$("p").append("A simple <strong>example</strong>");

Upvotes: 0

Cau&#234; Lorenzato
Cau&#234; Lorenzato

Reputation: 1

Instead of .html() why dont you try .text() ? I think it fits better.

Upvotes: 0

oneNiceFriend
oneNiceFriend

Reputation: 6891

This is just on chrome developer tool's reflection. If you check the html page source, you should not see this double quotas. try and share with us please.

Upvotes: 3

Related Questions