As I work on creating a form with error messages associated with each input/element, I have implemented the <aside>
tag in an interesting way. Here is what I have come up with:
<section class="fieldrow" id="rowJobTitle">
<label for="txtJobTitle" id="lblJobTitle">
<span>Job title:</span>
</label>
<input type="text" id="txtJobTitle" name="txtJobTitle">
<aside id="errJobTitle" class="errormessage">
<span role="alert">Please tell us your job title.</span>
</aside>
</section>
In order to toggle the display of these error messages using CSS and a bit of JS, I considered using just a span tag. However, since a span tag lacks semantic value, I decided to utilize the <aside>
tag instead. While most sources suggest that this approach should work fine, I am seeking validation or any potential drawbacks from those who have attempted it before.
Thank you, Si.