Stack Overflow - How to Add Dotted Underlining Using JavaScript

Example

by Braden Best

HTML

<p id="hello">Hello world</p>
<p id="hello">Hello 2</p>
<p id="hello">Hello 3</p>

CSS

/*No css*/

JavaScript

((function(){
    //If you put your script tag below the body, all ids are automatically 
    //assigned to variables. I.e. hello already exists
    for(var i in hello){
        hello[i].style.borderBottom = '2px dotted black';
    }
})());