document.addEventListener( 'wpcf7mailsent', function( event ) {
alert("ok");
jQuery('input').focusout(function() {
const label = $(this).parent().parent().find('label');
if (jQuery(this).val() != '') return;
label.animate({
'font-size': '17px',
'top': '10px',
});
})
}, false );
通过单击发送,如果发送成功,插件是否有事件wpcf7mailsent,那么我想从输入中删除焦点并将标签放到适当的位置,但是由于某种原因,它不起作用附言警报工作
这些只是通过单击输入对我有用的功能。标签在此上下移动
jQuery('input').focus(function() {
const label = $(this).parent().parent().find('label');
if (jQuery(this).val()=='') {
label.animate({
'top': '5px',
'font-size': '75%',
});
}
})
jQuery('input').focusout(function() {
const label = $(this).parent().parent().find('label');
console.log('Value ', jQuery(this).val());
if (jQuery(this).val() != '') return;
console.log('Passed if');
label.animate({
'font-size': '17px',
'top': '10px',
});
})
尝试返回false,或者您可以在提交按钮上再次单击focustout(单击)