javascript - Getting Blurred Element -
i have binded blur on input. on blur, want use $(this) , detect input. there way that?
<input data-john="x" data-doe="false"> $('[data-john=x]:not([data-doe=true])').blur(function() { console.log($(this)) }) in example, $(this) returning window, not blurred element.
is there way input using $(this)?
you can use $('input') blur() event , have this or $(this) in console.log:
$('input').blur(function() { console.log(this); console.log($(this).data('john')); console.log($(this).data('doe')); console.log($(this)); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input data-john="x" data-doe="false">
Comments
Post a Comment