i don't get any error message in my console, but .focus()
function in JQuery isn't work.
i'm used 2 function that is .focus
and .val('')
... .val('')
is working fine, but .focus()
isn't work
here's my HTML code :
$('.sukses').show(function(){
var notif = 'some message';
$('.notif').html(notif);
});
$('#kode').focus();
$('.kode_guru').val('');
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="alert alert-success sukses" style="display: none">
<strong>Success!</strong><p class="notif"></p>
</div>
<form action="#" id="form" class="form-horizontal" role="form">
<input onblur="this.focus()" type="text" name="guru" id="kode" class="kode_guru">
</form>
my program flow is, when something change in my textfield ('.kode_guru'), the notif will come out and text field will reset to '' and automaticly focused again for another input
hope you guys understand what i'm talking about thanks