TAGS :Viewed: 6 - Published at: a few seconds ago

[ how to give onchange submit on this page? ]

here i get ajax suggestion box it's working fine but when i give the suggested value it's not submit automatically manually am giving enter to proceed how to give on change submit ro this function
Here html

<form  id="search" method="get" action="advanced_search_result.php">
                <input type="text" size="20" name="keywords" value="" id="inputString" onkeyup="lookup(this.value);" onblur="fill();" autocomplete="off"  style="height:30px; width:265px;"  />
                </form>

Here script code

function lookup(inputString) {
        if(inputString.length == 0) {
            // Hide the suggestion box.
            $('#suggestions').hide();
        } else {
            $.post("rpc.php", {queryString: ""+inputString+""}, function(data){
                if(data.length >0) {
                    $('#suggestions').show();
                    $('#autoSuggestionsList').html(data);

                }
            });
        }
    } // lookup

    function fill(thisValue) {
        $('#inputString').val(thisValue);
        setTimeout("$('#suggestions').hide();", 200);
    }

Answer 1


Add this code wherever u want to submit form .. at ajax complete or keyup e.code==13

$("#search").submit();