Skip to content
Discussion options

You must be logged in to vote

Hi!

You can do that entirely in input phase by JavaScript. Try this example:

'<p id="v">'v = ? {150}'</p>
'<p>'d = ? {50}'</p>
#val
'<script>
'$("p#v input").focusout(function(){
'    var v = Number($(this).val());
'    if(v < 100 || v > 200) {
'        alert("Invalid value!!!"); 
'        $(this).css("color","red");
'    } else $(this).css("color","black");
'});
'</script>

Replies: 4 comments 7 replies

Comment options

You must be logged in to vote
5 replies
@fliptoback
Comment options

fliptoback Sep 5, 2025
Author Sponsor

@javila
Comment options

@fliptoback
Comment options

fliptoback Sep 5, 2025
Author Sponsor

@javila
Comment options

@fliptoback
Comment options

fliptoback Sep 5, 2025
Author Sponsor

Comment options

You must be logged in to vote
1 reply
@fliptoback
Comment options

fliptoback Sep 5, 2025
Author Sponsor

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@fliptoback
Comment options

fliptoback Sep 6, 2025
Author Sponsor

Answer selected by fliptoback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants