Next drawing

Play just by changing your search engine

Sounds good to be true doesn't it? We give away 1000's of genuine Lotto and Euromillions entries each week to users who have switched their search engine to Search Lotto.

Our service is completely free to use and we pay out 100% of any winnings to your PayPal or bank account.

Learn More
"Search Lotto is easy to use and I receive a couple of Lotto entries each week - I've won three times so far!"
John from Stratford-Upon-Avon

Meet more of our users and read their winning story Read More

function EnableHintButton(enable) { $("#hintBtn").prop("disabled", !enable); if (enable) { $("#hintBtn").addClass("dropdown-toggle"); } else { $("#hintBtn").removeClass("dropdown-toggle"); } } /** * Update Search Hints. */ var gUpdateHintsBusy = false; function UpdateHints() { if (!gUpdateHintsBusy) { // Sanity check gUpdateHintsBusy = true; let q = $("#q").val(); let params = { action: 'GetHints', searchterm: q }; $.ajax({ type: "post", url: "API.php", data: JSON.stringify(params), contentType: "application/json;charset=utf-8", dataType: "text" }) .done(function(data, txtStatus, xhr) { try { data = JSON.parse(data); } catch (e) { console.log("Parse JSON failed: " + e); data = null; } if (data) { if (data.rc != 0) { // Ajax call succeeded, but something else failed. console.log("GetHints failed with code " + data.rc + ": " + data.msg); } else { try { data = data.content; // From API response. let listData = ""; let searchRes = data.suggestionGroups[0].searchSuggestions; let maxRes = Math.min(searchRes.length, 5); for(let i = 0; i < maxRes; i++) { let dt = searchRes[i].displayText; let q = searchRes[i].query.replace("'", "'"); // Need to put this back before sending back to server. let le = `
${dt}
`; listData += le; } $("#hintList").html(listData); EnableHintButton(listData.length > 0); // Disabled 2023-03-22. $("div.hintItem").on("keydown", KBHintItemHandler); ShowHints(true); } catch (e) { // In case we get back garbage... } } } }) .fail(function(xhr, txtStatus, errorThrown) { let msg = txtStatus + ': ' + xhr.message; console.log(msg); }) .always(function() { gUpdateHintsBusy = false; }); } } /** * Show the search hints. * * @param show [in] true to show, false to hide. */ function ShowHints(show) { let haveShow = $("#searchGroup").hasClass("show"); let activeElement = $(document.activeElement); if (show) { // Want to show if (!haveShow) { // Not shown yet if ($("#hintList").children().length > 0) { $("#hintBtn").dropdown("toggle"); } } } else { // Want to hide if (haveShow) { // Showing now $("#hintBtn").dropdown("toggle"); } } if (activeElement) { // Put focus back where it was $(activeElement).focus(); } } var gKBTimerID = 0; var gKBLastKeyTime = 0; function StopKBTimer() { if (gKBTimerID != 0) { clearTimeout(gKBTimerID); gKBTimerID = 0; } } /** * Click anywhere in the document -- navigate if you clicked a hintItem. */ $(document).click(function(e) { let el = $(e.target); if ($(el).is("div") && $(el).hasClass("hintItem")) { let q = $(el).data("q"); if (q) { e.preventDefault(); e.stopPropagation(); ShowHints(false); $("#q").val(q); // Set input box to hint value. SetHintBusyState(); q = q.replace("'", "'"); let url = "search.php?q=" + encodeURIComponent(q); window.location.href = url; } } else { ShowHints(false); } }); /** * Keyboard handler for the Hint List. */ function KBHintItemHandler(e) { if (e.keyCode == 13) { // Navigate to the item e.preventDefault(); e.stopPropagation(); StopKBTimer(); // We should be on a hint list item, but be safe. if (document.activeElement) { let el = $(document.activeElement); if ($(el).is("div") && $(el).hasClass("hintItem")) { let q = $(el).data("q"); if (q) { ShowHints(false); $("#q").val(q); let url = "search.php?q=" + encodeURIComponent(q); window.location.href = url; } } } } else if (e.keyCode == 38 || e.keyCode == 40) { // Cursor up or down let hintList = $("#hintList").children(); let nHints = hintList.length; if (nHints > 1) { let el = $(e.target); // You could go wild here and wrap the selection, or even position the cursor back in the input field, BUT... let currentIndex = $(hintList).index(el); if (e.keyCode == 38) { if (--currentIndex < 0) { currentIndex = nHints; } } else { if (++currentIndex >= nHints) { currentIndex = 0; // Wrap to beginning } } $(hintList[currentIndex]).focus(); } } } /** * Keyboard handler for the query input field. */ function KBQueryHandler(e) { StopKBTimer(); if (e.keyCode == 9 || e.keyCode == 38 || e.keyCode == 40) { return; // Tab or cursor up/down: get out of here immediately and let popper go to work. } if (e.keyCode == 13) { // Focus state is uncertain, so just do the submission ourselves. e.preventDefault(); ShowHints(false); SetHintBusyState(); $("#fSearch").submit(); return; // Enter pressed, let submit work immediately. } let q = $("#q").val(); if (q.length == 0) { EnableHintButton(false); ShowHints(false); } else { if (q.length > 2 && !gUpdateHintsBusy) { gKBTimerID = setTimeout(UpdateHints, 500); } } gKBLastKeyTime = e.timeStamp; } /** * Show that I am busy submitting a query. */ function SetHintBusyState() { let q = $("#q"); // NO. Breaks submission. $(q).prop("disabled", true); $(q)[0].style.backgroundColor = "#CDCDCD"; } $(document).ready(function() { $("#fSearch").submit(function() { let q = $("#q"); let word = $(q).val(); let trimmedWord = word.trim(); if (trimmedWord.length == 0) { return false; // Don't submit empty query } if (trimmedWord.length != word.length) { $(q).val(trimmedWord); } SetHintBusyState(); }); $("#hintBtn").on("click", function(e) { if ($("#hintList").children().length == 0) { e.preventDefault(); e.stopPropagation(); return; } }); $("#q").on("keydown", KBQueryHandler); if (document.activeElement) { let el = $(document.activeElement); $(el).blur(); // Kill focus so mobile keyboard doesn't show } });