var enter = $('#enter').attr('value');
$('#enterButton').on("click", function() {
if(enter == "Enter" || enter == "enter") {
$('.loader').fadeOut(2000);
}
});
This is my code so far, I also tried using:
var enter = $('#enter').val();
But still nothing worked, so can anyone help me fix this? Thanks :)
EDIT: the html is:
<input id="enter" type="text" placeholder="Do what it says...">
<button class="btn" id="enterButton">Go!</button>
EDIT FINAL:
The final answer is:
$('#enterButton').on("click", function() {
var enter = $('#enter').val();
if(enter == "Enter" || enter == "enter") {
$('.loader').fadeOut(2000);
}
});
Because, the variable was outside, and was not updating with the button click :) Thanks @dystroy