You might have seen the “Unexpected tag <a> found, expecting one of <table>, <h4>,<h2>,<pre>,<noscript>” error in Netbeans. This happens when you create an anchor link. There will be a red “!” and light bulb on the line that is in question.
Here’s a screenshot of the error:
The reason why you are getting this error is that you are using XHTML with strict mode enabled. What you might not realize (or have forgotten) is that under strict xhtml markup inline elements must always be wrapped inside block level elements like <table>, <h4>, <h2>, <pre>, <div>, or <p>
So in order resolve this error the code should look something like this:
Notice how there is no longer a red “!”? As a side note although Netbeans normally has pretty good code hints I definitely think there is room for improvement. I hope this helps!
Leave a Reply