I am pretty new to jQuery so I have a problem with this. I am trying to check if input is empty by jQuery. I have this script:
$('#submit').click(function(){
if($.trim($('#username').val()) == ''){
alert('Input can not be left blank');
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input name="username" id="username" type="text" placeholder="Enter your Username"/>
<button class="btn btn-info btn-block login" name="submit" id="submit" type="submit">Create an Account</button>
Thanks for reply.