<input type='text' value='VLAN'/>
<input type='button' class="btn" id="user_input0" value='Change Text'/>
<input type='text' value='IP ADDRESS' />
<input type='button' class="btn" id="user_input1" value='Change Text'/>
<input type='text' value='SYSTEN LOC' />
<input type='button' class="btn" id="user_input2" value='Change Text'/>
<input type='text' value='GATEWAY' />
<input type='button' class="btn" id="user_input3" value='Change Text'/>
<p>
create vlan <b class="bold-stuff-0"></b> tag <b class="bold-stuff-0"></b><br>
config vlan <b class="bold-stuff-0"></b> add tagged 25-28<br>
config snmp system_name <b class="bold-stuff-1"></b><br>
config snmp system_loc <b class="bold-stuff-2"></b><br>
create iproute default <b class="bold-stuff-3"></b><br>
</p>
<script>
var buttons = document.querySelectorAll('.btn');
var b = document.querySelectorAll('b[class*=bold]');
buttons = Array.prototype.slice.call(buttons);
b = Array.prototype.slice.call(b);
buttons.forEach(function(el, i) {
el.addEventListener('click', function(e) {
var input = this.previousElementSibling;
var re = new RegExp(i);
b.forEach(function(el, i) {
if (re.test(el.className)) {
el.textContent = input.value;
}
});
});
});
</script>