Show only values that are set
<p>I have the following script that is working totally fine. that does some calculation on two fields and shows in a third field.</p>

<pre><code>     $(function() {
     $(document).on('change', 'td.evaluation select', function() {
        var gap = parseInt($(this).find(':selected').val())- parseInt($(this).parents('tr').find('td.mefly').text()) ;

        $(this).parents('tr').find('td.gap input:text').val(gap);
        if(gap&lt;0){
         $(this).parents('tr').find('td.gap input:text').css('background-color','red');
        }else  $(this).parents('tr').find('td.gap input:text').css('background-color','#3CB371');

     });
  });
</code></pre>

<p>Now I wanted to add a script to run the script on load of the page, with the values that have been stored previously. But it keeps the result blank.
Here is what I tried:</p>

<pre><code>        $(document).ready(function(){

            var gap = parseInt($("td.evaluation select").find(':selected').val())- parseInt($("td.evaluation select").parents('tr').find('td.mefly').text()) ;

            $("td.evaluation select").parents('tr').find('td.gap input:text').val(gap);
            if(gap&lt;0){
                $("td.evaluation select").parents('tr').find('td.gap input:text').css('background-color','red');
            }else  $("td.evaluation select").parents('tr').find('td.gap input:text').css('background-color','#3CB371');

        }

    )};
</code></pre>

<p>What did I do wrong?</p>
