Using keypress() and keyup() when using an onscreen keyboard -
i have lovely piece of code drives search box on php page, making search box dynamic, , works perfectly. i'm trying adapt it, , @ bit of loss.
at moment search must done on keyboard make search work. keypress() , keyup() functions within script.
my problem i'm trying use search onscreen keyboard , no physical keyboard, there never keypress or keyup.
is there can do think replace these.
would best add amended version of code below (without keypress/keyup) each onclick of onscreen keyboard, or amend code react onscreen clicks?
thanks if can help
<!--javascript turn keystrokes search value--> <script type="text/javascript"> $(document).ready(function () { // hide submit button $(":submit").hide(); // bind event keypress in order override form submission when pressing enter key $("input[name='search_term']").keypress(function (e) { if (e.which == 13) { // prevent form submitting in normal manner (return key) e.preventdefault(); } }); // bind event keypress event of text box $("input[name='search_term']").keyup(function () { // search value var search_value = $(this).val(); // time we're going grab data file display var filename = "functions/search.php"; // send these values var posting = $.post(filename, { search_term: search_value }); // display value in our results container posting.done(function (data) { $("#search_results").empty().append(data); }); }); }); </script>
Comments
Post a Comment