遺漏的類型錯誤:$(本).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