weixin_33720956 2016-05-16 19:45 采纳率: 0%
浏览 36

如何自动发布提交?

I want to post automatically when the input value is written. Please can you help? The form is as follows:

<form method="post" action="searchresults.php">
     <input type="text" name="searchresult">
     <input type="submit">
</form>
  • 写回答

2条回答 默认 最新

  • weixin_33738555 2016-05-16 19:51
    关注

    This should be done with jQuery.

    $('#toPost').keyup(function(){
      $('#sub').click();
    });
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <form method="post" action="searchresults.php">
    
    <input type="text" name="searchresult" id="toPost">
    <input type="submit" id="sub">
        
    </form>

    </div>
    
    评论

报告相同问题?