How to hide and display text box using jquery?
Suppose I have an email text box input. I want it to display a re-enter email text box when the user has entered a valid email address.
Can anyone give me direction as to how I can make that happen?
In Jquery we have the hide() and show() functions to hide any particular control from the UI. using that we can hide and show the controls
Example:
<html>
<head>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
// onclick of hide
$(".hide").click(function(){
// hiding the text box using hide()
$("#em").hide();
});
$(".show").click(function(){
// show will show the element
$("#em").show();
});
});
</script>
</head>
<body>
<input type="email" id="em"/>
<button class="hide">Hide</button>
<button class="show">Show</button>
</body>
</html>
Note : If you like my answer please rate and help me it is very Imp for me
Get Answers For Free
Most questions answered within 1 hours.