try this:
var wd = document.querySelectorAll('[wd]')
for(var i = 0; i < wd.length; i++){
wd[i].style.width = wd[i].attributes.wd.value +'px'
}
square{
display:block;
height:50px;
background:red;
margin-bottom:10px
}
<square wd="100"></square>
<square wd="200"></square>
<square wd="300"></square>
if you have a specific range of possible width you could target it directly (CSS solution) with square[wd='100']{width:100px}
square{
display:block;
height:50px;
background:red;
margin-bottom:10px
}
square[wd='100']{width:100px}
square[wd='200']{width:200px}
square[wd='300']{width:300px}
<square wd="100"></square>
<square wd="200"></square>
<square wd="300"></square>
wdwithin a specific limit. Like 0-100, or, 10,20,30,...,300 or so? Or can it just be anything?