I'm trying to show the .hideme
message on click of submit
only when it is disabled.
And the .hideme
should be unique for each submit
. I'm not sure if I should use data-attributes to associate them.
$(document).ready(function() {
$("#post-1").hide();
$("#post-1").click(postNotification);
});
function postNotification() {
$("#post-1")
.show()
.animate({
height: "30px",
opacity: 1
}, 250)
.delay(2000)
.animate({
height: "0px",
opacity: 0
}, 250);
}
.hideme {
background: blue;
height: 0px;
opacity: 0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="first">
<div class="hideme" id="post1">Message 1</div>
<input type="text" name="name" autocomplete="off" required/>
<input type="submit" data-submit="1" id="post1" disabled></input>
</div>
<div class="second">
<div class="hideme" id="post2">Message 2</div>
<input type="text" name="name" autocomplete="off" required/>
<input type="submit" data-submit="2" id="post2"></input>
</div>