Set Value of form input from variable in Jquery
<p>I have a variable named colWidth in jquery which runs some math on numbers grabbed from an input using jquery. How do I set a value of an input field with an id of #test to the value of colWidth?</p>

<pre><code>$("input#width").keyup(function () {
  var value = $(this).val();
  $("span#width-text").text(value);
}).keyup();

$("input#columns").keyup(function () {
  var value = $(this).val();
  $("span#columns-text").text(value);
}).keyup();

$("input#gutter").keyup(function () {
  var value = $(this).val();
  $("span#gutter-text").text(value);
}).keyup();

$("input#gutter").keyup(function () {
  var value = $(this).val();
  $("span#gutter-text").text(value);
}).keyup();

$(function(){
    $('a#calc').click(function(){
        var width = $('input#width').val();
        var col = $('input#columns').val();
        var gutter = $('input#gutter').val();
        var newWidth = width / col;
        var colSize = (gutter + gutter) * col;
        var colWidth = newWidth - colSize;
        $('input#test').val(colWidth);
    });
 });
</code></pre>
