I got an input field that displays a bootstrap tooltip when focused.
<input id="nombrecurso" name="nombrecurso"
data-original-title="Required field!"
data-toggle="tooltip" data-trigger="hover"
data-delay='{"show":"200", "hide":"0"}'
class="form-control input-lg">
<h6 class="count_message pull-right"></h6>
The Number of characters remaining for that field is displayed in a near <h6>
. This counter is updated on a jquery keyup
event.
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
});
$(document).on("keyup", '#nombrecurso' ,function() {
$(this).next('.count_message').empty().append($(document.activeElement).attr('maxlength') + ' characters remaining');
//event code, is doesn't have to be keyup, it happens with
//other events such as click
}
The problem is when the tooltip is active, the jquery event keyup doesn't fire up and the counter is not updated.
You can see the problem here: codepen.
Try to write something in the input with and without the mouse over the input field.
...Any ideas how to fix this?