I've been trying to use the name and value of input fields to set the styles on a button but to no avail, it only appears to return the last value and then a letter of the value.
$(':input').each(function() {
var inputvalue = $(this).val();
var inputname = $(this).attr("name");
// alert(inputvalue)
// alert(inputname)
$(".button").attr("style" , inputname[0] + ":" + inputvalue[0] + ";" + inputname[1] + ":" + inputvalue[1]);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<input type="text" value="1px" name="border-width">
<select name="border-style">
<option value="none">None</option>
<option value="solid">Solid</option>
<option value="dotted">Dotted</option>
<option value="dash">Dashed</option>
</select>
<input type="text" value="green" name="border-color">
<div class="button"></div>