最佳答案
您需要将代码包装在.ready()中,以便在DOM准备好时执行它.
$(document).ready(function() {
$("#searchForm").submit(function(e){
e.preventDefault();
});
});