 <p>There are probably a lot of ways, but why not treat direction as a optional argument, which when not set indicates a reset condition.</p> <pre><code>function changestart(direction) { var startElement = $("#startID"); if ( direction ) { var rowsElement = $("#maxrows"); var rowsValue = parseInt(rowsElement.val()); var value = parseInt(startElement.val()); startElement.val(direction == "forward" ? value + rowsValue : direction == "back" ? value - rowsValue : 1); } else { startElement.val( 0 ); } } $("#previous").click(function(){changestart('back');}); $("#next").click(function(){changestart('forward');}); // not working $("#lookup").click(function(){changestart();}); </code></pre>