I have this simple feature that when I click a button there will be a message that says Success
It is working but only on the first time when the button is clicked, when I click the button for the second time and again and again the message Success is not showing anymore.
Here's my jQuery/Javascript code
$(document).ready(function() {
$('#submit').click(function(e){
e.preventDefault();
var message = 'Success';
$('#message').html(message).delay(5000).fadeOut(400);
})
})
It seems that .html(message).delay(5000).fadeOut(400); is the suspect or am i wrong?
This is my Html code
<div id="message"></div>
<input type="submit" value="submit" id="submit">
I have js fiddle for it. Here's the link https://jsfiddle.net/2dn9p1hv/