我有一個input
和一些結果,如果有任何結果與其文本標題與輸入的確切.val()
不匹配,則應刪除其.parent().parent()
。我有被靶向錯this
爲我做$this.parent().parent().hide();
但$this
問題是var $this = jQuery(this).text().toLowerCase();
如何刪除元素,如果其文本不符合其他元素文本?
function fetch(){
jQuery.ajax({
url: '<?php echo admin_url('admin-ajax.php'); ?>',
type: 'post',
data: { action: 'data_fetch', exactwords: jQuery('#usp-title').val() },
success: function(data) {
var text2;
var text2B;
text2 = jQuery('#usp-title').val();
text2B = text2.toLowerCase();
jQuery("#datafetch").html(data).promise().done(function(){
jQuery("#datafetch ul li h2 a").each(function() {
var $this = jQuery(this).text().toLowerCase();
if ($this != text2B) {
$this.parent().parent().hide();
} else if (text1B == text2B) {
jQuery("#componi").attr("disabled", "disabled").hide();
}
});
});
}
});
}
優秀,很好地工作。非常感謝 –
其實我們以前見過這裏,不錯的名字;-) –
乾杯,很高興它的工作!是的,我們有 - 確實很好的名字:-P –