$(':input').bind 'change', (event) => N = $('#entN').val() S = $('#entS').val() S = Math.max S, 0 S = Math.min S, N $("#entS").val S f = S/N $("#sorF").text (f*100).toFixed 2 h = 1.96*Math.sqrt f*(1-f)/N c1 = Math.max 0, f-h c2 = Math.min 1, f+h $("#a1").text (100*c1).toFixed 2 $("#a2").text (100*c2).toFixed 2