<script> function change_size() { var width = parseInt($("#Width").val()); var height = parseInt($("#Height").val()); if(!width || isNaN(width)) { width = 600; } if(!height || isNaN(height)) { height = 400; } $("#Demo").width(width).height(height); // update perfect scrollbar $('#Demo').perfectScrollbar('update'); } $(function() { $('#Demo').perfectScrollbar(); }); </script>