Yes, the script requires <a>
elements for triggering the sub menus so some modifications would be needed if you would like to use <span>
‘s instead.
However, I am not sure there is any serious reason for not using <a>
‘s, is there? You could even omit the href
attribute if you like (not advisable) and it would still work properly with mouse/touch:
...
<li><a>About</a>
<ul>
...
On the other hand, there is a serious reason for using <a>
s inside parent menu items (and not omitting the href
as in the above example) – without a link element your parent menu item loses its ability to gain focus and thus the sub menu becomes completely inaccessible via the keyboard (unless you specifically add a tabindex
attribute to your <span>
‘s but that is still not a perfect replacement for a real link).