我正在使用几个文本框的形式,重点关注并集中注意事件。我无法触发按钮上的点击事件,因为当我从文本框中丢失写入时,焦点输出事件。如何在焦点之后触发点击事件进行。
$(document).on("focusout", ".fn-enlargeTextarea", function(event) {
var optionNumber = ($(this).attr('id').replace('1option','')).trim();
$('#1option'+optionNumber+'_counter').remove();
$(this).removeClass('textarea-height01').addClass('textarea-height02');
});
答案 0 :(得分:1)
您可以使用event.relatedtarget
$(document).on("focusout", ".fn-enlargeTextarea", function(event) {
var optionNumber = ($(this).attr('id').replace('1option','')).trim();
$('#1option'+optionNumber+'_counter').remove();
$(this).removeClass('textarea-height01').addClass('textarea-height02');
var targetEvent = event.relatedTarget;
$(targetEvent).click();
});