Reputation: 4581
I am very new in Javascript.
I want to make some basic stuffs that can be used in my future project.
One of the stuffs I need is highlighting some keywords.
You can find the working code for the functionality at the above link.
The problem is if I uncomment the following line in HTML,
<!-- <h1>Polls show Romney surging ahead of Gingrich in Florida</h1> -->
The functionality does not work.
What is the problem and how to solve the problem?
Upvotes: 0
Views: 37
Reputation: 39902
You can't have block level elements inside a paragraph tag.
<p><h1></h1></p> <!-- Not valid HTML! -->
If you want the heading to be inside the <p>
and searchable then change the <p>
to a <div>
Upvotes: 2