I have a HTML file that has a modified style so that the underline tag results in a dotted line.
<style type="text/css">
u {
border-bottom: 1px dashed #999;
text-decoration: none;
}
</style>
I want a function that will find elements by class and apply this underline style. It needs to be in a JS function because the underlining only occurs during certain events (mouseover and onclick). What would my javascript code look like?
So far I have:
function underline(id){
var elements = document.getElementsByClassName(id);
for(var i=0; i<elements.length; i++){
elements[i].style.?????}
}