[英]How do toggle click event with focusout in jquery
我有幾個帶有焦點對准和焦點對准事件的文本框的窗體。無法觸發按鈕上的單擊事件,因為一旦失去從文本框的書寫,焦點對准事件即被調用。如何在焦點對准焦點后觸發單擊事件。
$(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');
});
您可以使用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();
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.