 <p>You already got it, you just needed to create the container for the output (the <code>numnights</code> element). </p> <p>Anyway the code is a little bit cleaner in this way:</p> <hr> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function(){ $(".daypicker").on('change', function(){calculateNights();}); }); function calculateNights() { var arrivalday = $("#arrivalday").val(); var departureday = $('#departureday').val(); var numberNights = departureday - arrivalday; numberNights = (numberNights &lt; 1) ? numberNights + 7 : numberNights; $("#numNights").html(numberNights); }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt; &lt;select required="required" class="daypicker" id="arrivalday" name="arrivalday"&gt; &lt;option&gt;&lt;/option&gt; &lt;option value="1"&gt;Monday&lt;/option&gt; &lt;option value="2"&gt;Tuesday&lt;/option&gt; &lt;option value="3"&gt;Wednesday&lt;/option&gt; &lt;option value="4"&gt;Thursday&lt;/option&gt; &lt;option value="5"&gt;Friday&lt;/option&gt; &lt;option value="6"&gt;Saturday&lt;/option&gt; &lt;option value="7"&gt;Sunday&lt;/option&gt; &lt;/select&gt; &lt;select required="required" class="daypicker" id="departureday" name="departureday"&gt; &lt;option&gt;&lt;/option&gt; &lt;option value="1"&gt;Monday&lt;/option&gt; &lt;option value="2"&gt;Tuesday&lt;/option&gt; &lt;option value="3"&gt;Wednesday&lt;/option&gt; &lt;option value="4"&gt;Thursday&lt;/option&gt; &lt;option value="5"&gt;Friday&lt;/option&gt; &lt;option value="6"&gt;Saturday&lt;/option&gt; &lt;option value="7"&gt;Sunday&lt;/option&gt; &lt;/select&gt; &lt;hr&gt; &lt;div id="numNights"&gt;&lt;/div&gt;</code></pre> </div> </div> </p> <p>Hope it helps!</p>