我有一個提交輸入字段的問題。我知道我不是第一個問這個問題的人,但我看到了答案,但他們沒有工作。輸入字段沒有提交輸入新聞
我有一個輸入欄和一個div內的提交按鈕。我有代碼工作,以便您可以搜索按鈕按下,但我不能提交輸入新聞工作。
HTML:
<div class="search singers" action="templates/search/search_singer.php" method="POST">
<input name="search" type="text" id="search" placeholder="Search here for singers" onkeyup="autosug();" data-file="search_singers"/><input class="button" type="submit" value="Search" onclick="search();"/>
<div id="output" class="output">
</div>
</div>
jQuery代碼:
var link = '#search';
//post input
$(function(){
$(link).keydown(function(e){
if (e.keyCode == 13) {
$(link).submit();
//He detect an enter press but stops then
}
});
});
我發現jQuery代碼上this site
在這裏,類似的問題:here
問題sovled我來了在我有一個功能讓我的想法ajax請求將數據發送到php。我現在在輸入新聞時呼叫該功能。
而第二件事你autonsan功能這只是你的HTML代碼,或者您忘記提交你的整個代碼? – Saty
現在來看看。我添加了輸入字段 – Vinc199789
的整體div,其中是您的窗體標籤? – Saty