asked on February 23, 2018
Trying to test for percentage value not to exceed 100. My code is below. I am using a hidden field to capture the total percentages entered. The alert does not work.
The value error does appear for the field after it is clicked on, but I need something that will detect the value of this field on a change not just a click or blur.
//Make sure percent does not exceed 100! $( document ).ready(function() { $(document).change('.percent input, .totalPer input, .Submit', percen); function percenTest() { var tPercen = $('.totalPer input').val(); alert('Percentage is currently: ', tPercen); if (tPercen > 100) { alert('Percentages can not be greater than 100!'); } else{ alert('Percentage equals: ', tPercen); } }); });
0
0