Dears i have below code that's make restrict to input with max value
it's working fine if the user tried to change it manually
but if the change happened dynamically from the jquery it's not working
$( "#materials" ).on('change','select',function(e){ var value = $(this).val(); if ((value !== '') && (value.indexOf('.') === -1)) { $(this).val(Math.max(Math.min(value, 3), 0)); // it's set the input value t 3 as max value } }); $( "#materials" ).val(300); // it's changing the value alawys so the last line change the input to 300, but if the user can't make it above 3
So how can i refuse any changing in the value even with dynamic changes