遗漏的类型错误:$(本).search不是一个函数
$(document).ready(function(){
$('#caption').on('keypress', function() {
var n = $(this).search('#');
if(n != "-1"){
window.alert("There's a hash");
}else{
window.alert("There's not a hash");
}
});
});
你需要'find'! –
什么是'#标题',以什么方式搜索'#'?它是价值,HTML还是属性? – 4castle
#是textarea的值 – Linuxe