我有一个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 –