Reputation: 12044
I have the next code declared in my on ready:
jQuery("body").delegate(".ta_obsn", "focusout", function() {
alert("Fired method");
jQuery(".tas")
.append('<textarea type="text" class="form-control" class="ta_observacion"></textarea>');
});
This problems occurs with the focusout
and blur
methods, but if I replace the change
instead focusout
the method is fired.
How I can use focousout
using delegate (or similar behavior)?
Upvotes: 0
Views: 1951
Reputation: 178350
We nowadays delegate with .on, in your case
$("body").on("focusout",".ta_obsn", function() ...
Upvotes: 2
Reputation: 317
You should use .on with latest jQuery:
$('body').on('blur','.ta_obsn',function(){
//Your code goes here
});
Upvotes: 0
Reputation: 8131
As of jQuery 3.0, .delegate has been deprecated we now use the .on() instead http://api.jquery.com/delegate/
seems fine with the none deprecated '.on()' method
$("input").on("focusout", function() {
$("div").append('focusout invoked ! ');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
</div>
<input type="text">
<input type="text">
Upvotes: 0