Bootstrap Community, frontend Development

I have a simple form using bootstrap. I tried to insert a text using jQuery when user clicks button, but It only displays in few seconds then disappear. Can you help me to fix that ? Here is the code :

<!DOCTYPE html>

<html lang="en">

<head>

<title>Bootstrap Example</title>

<meta charset="utf-8">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>

<script>

$(document).ready(function(){

$("button").click(function(){

$('#alert').toggleClass('container');

$('#alert').html('Wrong login. Please try again !');

$("#alert").fadeOut(4000);

});

});

</script>

</head>

<body>

<div class="container">

<h2>Vertical (basic) form</h2>

<div class="text-danger" id="alert"></div>

<form method="POST">

<div class="form-group">

<label for="email">Email:</label>

<input type="email" class="form-control" id="email" placeholder="Enter email" name="email">

</div>

<div class="form-group">

<label for="pwd">Password:</label>

<input type="password" class="form-control" id="pwd" placeholder="Enter password" name="pwd">

</div>

<div class="checkbox">

<label><input type="checkbox" name="remember"> Remember me</label>

</div>

<button type="submit" class="btn btn-default">Submit</button>

</form>

</div>

</body>

</html>

Appreciate your help. Thanks.

bambostar () - 2 weeks ago - Reply 0