Search code examples
jquerysemanticssemantic-markup

HTML/jQuery: Semantically tagging glossary-enabled terms in body copy


All,

I'm working on adding a glossary to an existing site. I'm planning to set up individual .html fragments with individual definitions, then use a jQuery Tooltip plugin attached to individual terms in the copy that will pull the .html fragment and render it.

This avoids having to pre-load many definitions into each page's HTML (I don't have a server-side dynamic language at my disposal - long story - so this is the best way I've thought of to do this).

My initial thought is to use <dt> tags around terms that have definitions, and then have jQuery attach the tooltip to each term. So my markup would remain very clean and simple:

<p>Lorem ipsum dolor <dt>amet</dt></p>

This is nice because I am not using the dt/dl/dd tags anywhere else on the site, nor do I plan to.

Is this a reasonable solution? Or is it incorrect to use a <dt> when it is not inside a <dl>?


Solution

  • That is an acceptable solution, although it is not technically valid HTML to have, as you said, a dt inside a dl. If you need it to be valid HTML, use the DFN tag.