首先对不起我的英语不好。我不是jQuery专家 我正在尝试为我的应用程序实时搜索查询。于是我米尝试和失败... :(如何使用jquery keypress事件来隐藏匹配或启动班级名称
请检查代码:
$(document).ready(function(){
$("#test").keypress(function(event) {
var $gettag = $("#test").val();
$('p[class^="tr"]').hide(1000); \t
//$('p[class^="tr"]').hide(1000); its works fine
});
});
<p>Name: <input type="text" id="test" value="Mickey Mouse"></p>
<p>This is a paragraph with little content.</p>
<p class="try">This is another small paragraph.</p>
<p class="tiy">iiiiiiiiiiiiiiiThis is another small paragraph.</p>
我想隐藏的P级的输入框是什么类型的 希望可以得到帮助,提前致谢
你的代码已经包含隐藏在''keypress'类tr'了'p'标签。你还期望它做什么? – doutriforce
嗨doutriforce,我想隐藏'尝试'类的'P'标签 – user3230844
您的代码已经这样做了。如果你想隐藏包含“try”类的_only_元素,你的选择器应该是'$('。try')'。 – doutriforce