我需要清除文本和隐藏图像,当有人删除使用jquery的输入文本内的消息这里是我的代码,但现在不工作现在有人向我展示样本片段?jquery输入自动清除文本
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
var urltext = $("#https_urllink").val();
$("#https_urllink").onkeydow(function(){
if(urltext == ""){
$("#httpstext").text("");
$("#httpsimage").hide();
}else if(urltext != "www.ilik.com"){
$("#httpstext").text("hello no");
} }); });
</script>
这里是我的HTML
<img src="hmm.png" id="httpsimage"/>
<div id="httpstext">See her</div>
<input type="text" id="https_urllink" value="delete now"/>
onkeydow(函数(){??应的onkeydown(函数(){ – Poria
也尝试检查空值一样,如果(urltext.length <1) – Poria
它没't工作@Poria – Micheal