Answers for "change color of input if submit clicked and input is empty"

0

change color of input if submit clicked and input is empty

HTML :
Text <input type="text">
<button>Click Me</button>
--------------------------
JQuery :
$("button").on("click",function(){
    if($("[type='text']").val() == null){
        $(this).css("border","2px solid red");
    } 
});
Posted by: Guest on June-07-2021

Code answers related to "change color of input if submit clicked and input is empty"

Code answers related to "Javascript"

Browse Popular Code Answers by Language