Categories Programming & Tech

Building a Honeypot Field That Works | CSS-Tricks

<div><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine; &NewLine; &NewLine;<&sol;p><p>Honeypots are fields that developers use to prevent spam submissions&period;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p><strong>They still work in 2025&period;<&sol;strong><&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>So you don’t need <a href&equals;”https&colon;&sol;&sol;cloud&period;google&period;com&sol;security&sol;products&sol;recaptcha” rel&equals;”noopener”>reCAPTCHA<&sol;a> or other annoying mechanisms&period;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>But you got to set a couple of tricks in place so spambots can’t detect your honeypot field&period;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><span id&equals;”more-388560″&sol;><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;<&sol;p><h3 class&equals;”wp-block-heading” id&equals;”use-this”><a href&equals;”&num;aa-use-this” aria-hidden&equals;”true” class&equals;”aal&lowbar;anchor” id&equals;”aa-use-this”><svg aria-hidden&equals;”true” class&equals;”aal&lowbar;svg” height&equals;”16″ version&equals;”1&period;1″ viewbox&equals;”0 0 16 16″ width&equals;”16″><path fill-rule&equals;”evenodd” d&equals;”M4 9h1v1H4c-1&period;5 0-3-1&period;69-3-3&period;5S2&period;55 3 4 3h4c1&period;45 0 3 1&period;69 3 3&period;5 0 1&period;41-&period;91 2&period;72-2 3&period;25V8&period;59c&period;58-&period;45 1-1&period;27 1-2&period;09C10 5&period;22 8&period;98 4 8 4H4c-&period;98 0-2 1&period;22-2 2&period;5S3 9 4 9zm9-3h-1v1h1c1 0 2 1&period;22 2 2&period;5S13&period;98 12 13 12H9c-&period;98 0-2-1&period;22-2-2&period;5 0-&period;83&period;42-1&period;64 1-2&period;09V6&period;25c-1&period;09&period;53-2 1&period;84-2 3&period;25C6 11&period;31 7&period;55 13 9 13h4c1&period;45 0 3-1&period;69 3-3&period;5S14&period;5 6 13 6z”&sol;><&sol;svg><&sol;a>Use This<&sol;h3><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;<&sol;p><p>I’ve created a <a href&equals;”https&colon;&sol;&sol;splendidlabz&period;com&sol;docs&sol;svelte&sol;forms&sol;honeypot&sol;” rel&equals;”noopener”><code>Honeypot<&sol;code> component<&sol;a> that does everything I mention below&period; So you can simply import and use them like this&colon;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><pre rel&equals;”Svelte” class&equals;”wp-block-csstricks-code-block language-markup” data-line&equals;””><code markup&equals;”tt”>&NewLine;&NewLine;<honeypot name&equals;”honeypot-name”&sol;><&sol;code><&sol;pre><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>Or&comma; if you use Astro&comma; you can do this&colon;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><pre rel&equals;”Astro” class&equals;”wp-block-csstricks-code-block language-javascript” data-line&equals;””><code markup&equals;”tt”>—&NewLine;import &lbrace; Honeypot &rcub; from ‘&commat;splendidlabz&sol;svelte’&NewLine;—&NewLine;&NewLine;<honeypot name&equals;”honeypot-name”&sol;><&sol;code><&sol;pre><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>But since you’re reading this&comma; I’m sure you kinda want to know what’s the necessary steps&period;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;<&sol;p><h3 class&equals;”wp-block-heading” id&equals;”preventing-bots-from-detecting-honeypots”><a href&equals;”&num;aa-preventing-bots-from-detecting-honeypots” aria-hidden&equals;”true” class&equals;”aal&lowbar;anchor” id&equals;”aa-preventing-bots-from-detecting-honeypots”><svg aria-hidden&equals;”true” class&equals;”aal&lowbar;svg” height&equals;”16″ version&equals;”1&period;1″ viewbox&equals;”0 0 16 16″ width&equals;”16″><path fill-rule&equals;”evenodd” d&equals;”M4 9h1v1H4c-1&period;5 0-3-1&period;69-3-3&period;5S2&period;55 3 4 3h4c1&period;45 0 3 1&period;69 3 3&period;5 0 1&period;41-&period;91 2&period;72-2 3&period;25V8&period;59c&period;58-&period;45 1-1&period;27 1-2&period;09C10 5&period;22 8&period;98 4 8 4H4c-&period;98 0-2 1&period;22-2 2&period;5S3 9 4 9zm9-3h-1v1h1c1 0 2 1&period;22 2 2&period;5S13&period;98 12 13 12H9c-&period;98 0-2-1&period;22-2-2&period;5 0-&period;83&period;42-1&period;64 1-2&period;09V6&period;25c-1&period;09&period;53-2 1&period;84-2 3&period;25C6 11&period;31 7&period;55 13 9 13h4c1&period;45 0 3-1&period;69 3-3&period;5S14&period;5 6 13 6z”&sol;><&sol;svg><&sol;a>Preventing Bots From Detecting Honeypots<&sol;h3><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;<&sol;p><p>Here are two things that you must <em>not<&sol;em> do&colon;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><ol class&equals;”wp-block-list”>&NewLine;<li>Do not use <code><input type&equals;”hidden”&sol;><&sol;code>&period;<&sol;li>&NewLine;&NewLine;&NewLine;&NewLine;<li>Do not hide the honeypot with inline CSS&period;<&sol;li>&NewLine;<&sol;ol><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>Bots today are already smart enough to know that these are traps — and they will skip them&period;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>Here’s what you need to do instead&colon;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><ol class&equals;”wp-block-list”>&NewLine;<li>Use a <code>text<&sol;code> field&period;<&sol;li>&NewLine;&NewLine;&NewLine;&NewLine;<li>Hide the field with CSS that is <em>not<&sol;em> inline&period;<&sol;li>&NewLine;<&sol;ol><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>A simple example that would work is this&colon;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><pre rel&equals;”HTML” class&equals;”wp-block-csstricks-code-block language-markup” data-line&equals;””><code markup&equals;”tt”><input class&equals;”honeypot” type&equals;”text” name&equals;”honeypot”&sol;>&NewLine;&NewLine;<&sol;code><&sol;pre><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>For now&comma; placing the <code&sol;> tag near the honeypot seems to work&period; But you might not want to do that in the future &lpar;more below&rpar;&period;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;<&sol;p><h3 class&equals;”wp-block-heading” id&equals;”unnecessary-enhancements”><a href&equals;”&num;aa-unnecessary-enhancements” aria-hidden&equals;”true” class&equals;”aal&lowbar;anchor” id&equals;”aa-unnecessary-enhancements”><svg aria-hidden&equals;”true” class&equals;”aal&lowbar;svg” height&equals;”16″ version&equals;”1&period;1″ viewbox&equals;”0 0 16 16″ width&equals;”16″><path fill-rule&equals;”evenodd” d&equals;”M4 9h1v1H4c-1&period;5 0-3-1&period;69-3-3&period;5S2&period;55 3 4 3h4c1&period;45 0 3 1&period;69 3 3&period;5 0 1&period;41-&period;91 2&period;72-2 3&period;25V8&period;59c&period;58-&period;45 1-1&period;27 1-2&period;09C10 5&period;22 8&period;98 4 8 4H4c-&period;98 0-2 1&period;22-2 2&period;5S3 9 4 9zm9-3h-1v1h1c1 0 2 1&period;22 2 2&period;5S13&period;98 12 13 12H9c-&period;98 0-2-1&period;22-2-2&period;5 0-&period;83&period;42-1&period;64 1-2&period;09V6&period;25c-1&period;09&period;53-2 1&period;84-2 3&period;25C6 11&period;31 7&period;55 13 9 13h4c1&period;45 0 3-1&period;69 3-3&period;5S14&period;5 6 13 6z”&sol;><&sol;svg><&sol;a>Unnecessary Enhancements<&sol;h3><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;<&sol;p><p>You may have seen these other enhancements being used in various honeypot articles out there&colon;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><ul class&equals;”wp-block-list”>&NewLine;<li><code>aria-hidden<&sol;code> to prevent screen readers from using the field<&sol;li>&NewLine;&NewLine;&NewLine;&NewLine;<li><code>autocomplete&equals;off<&sol;code> and <code>tabindex&equals;”-1″<&sol;code> to prevent the field from being selected<&sol;li>&NewLine;<&sol;ul><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><pre rel&equals;”HTML” class&equals;”wp-block-csstricks-code-block language-markup” data-line&equals;””><code markup&equals;”tt”><input &period;&period;&period;&equals;”” aria-hidden&equals;”” autocomplete&equals;”off” tabindex&equals;”-1″&sol;><&sol;code><&sol;pre><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>These aren’t necessary <a href&equals;”https&colon;&sol;&sol;css-tricks&period;com&sol;hiding-content-responsibly&sol;”>because <code>display&colon; none<&sol;code> itself already does the things these properties are supposed to do<&sol;a>&period;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;<&sol;p><h3 class&equals;”wp-block-heading” id&equals;”future-proof-enhancements”><a href&equals;”&num;aa-future-proof-enhancements” aria-hidden&equals;”true” class&equals;”aal&lowbar;anchor” id&equals;”aa-future-proof-enhancements”><svg aria-hidden&equals;”true” class&equals;”aal&lowbar;svg” height&equals;”16″ version&equals;”1&period;1″ viewbox&equals;”0 0 16 16″ width&equals;”16″><path fill-rule&equals;”evenodd” d&equals;”M4 9h1v1H4c-1&period;5 0-3-1&period;69-3-3&period;5S2&period;55 3 4 3h4c1&period;45 0 3 1&period;69 3 3&period;5 0 1&period;41-&period;91 2&period;72-2 3&period;25V8&period;59c&period;58-&period;45 1-1&period;27 1-2&period;09C10 5&period;22 8&period;98 4 8 4H4c-&period;98 0-2 1&period;22-2 2&period;5S3 9 4 9zm9-3h-1v1h1c1 0 2 1&period;22 2 2&period;5S13&period;98 12 13 12H9c-&period;98 0-2-1&period;22-2-2&period;5 0-&period;83&period;42-1&period;64 1-2&period;09V6&period;25c-1&period;09&period;53-2 1&period;84-2 3&period;25C6 11&period;31 7&period;55 13 9 13h4c1&period;45 0 3-1&period;69 3-3&period;5S14&period;5 6 13 6z”&sol;><&sol;svg><&sol;a>Future-Proof Enhancements<&sol;h3><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;<&sol;p><p>Bots get smarter everyday&comma; so I won’t discount the possibility that they can catch what we’ve created above&period; So&comma; here are a few things we can do today to future-proof a honeypot&colon;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><ol class&equals;”wp-block-list”>&NewLine;<li>Use a legit-sounding <code>name<&sol;code> attribute values like <code>website<&sol;code> or <code>mobile<&sol;code> instead of obvious honeypot names like <code>spam<&sol;code> or <code>honeypot<&sol;code>&period;<&sol;li>&NewLine;&NewLine;&NewLine;&NewLine;<li>Use legit-sounding CSS class names like <code>&period;form-helper<&sol;code> instead of obvious ones like <code>&period;honeypot<&sol;code>&period;<&sol;li>&NewLine;&NewLine;&NewLine;&NewLine;<li>Put the CSS in another file so they’re further away and harder to link between the CSS and honeypot field&period;<&sol;li>&NewLine;<&sol;ol><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>The basic idea is to trick spam bot to enter into this &OpenCurlyDoubleQuote;legit” field&period;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><pre rel&equals;”HTML” class&equals;”wp-block-csstricks-code-block language-markup” data-line&equals;””><code markup&equals;”tt”><input class&equals;”form-helper” &period;&period;&period;&equals;”” name&equals;”occupation”&sol;>&NewLine;&NewLine;<&excl;– Put this into your CSS file&comma; not directly in the HTML –>&NewLine;<&sol;code><&sol;pre><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>There’s a very high chance that bots won’t be able to differentiate the honeypot field from other legit fields&period; <&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;<&sol;p><h3 class&equals;”wp-block-heading” id&equals;”even-more-enhancements”><a href&equals;”&num;aa-even-more-enhancements” aria-hidden&equals;”true” class&equals;”aal&lowbar;anchor” id&equals;”aa-even-more-enhancements”><svg aria-hidden&equals;”true” class&equals;”aal&lowbar;svg” height&equals;”16″ version&equals;”1&period;1″ viewbox&equals;”0 0 16 16″ width&equals;”16″><path fill-rule&equals;”evenodd” d&equals;”M4 9h1v1H4c-1&period;5 0-3-1&period;69-3-3&period;5S2&period;55 3 4 3h4c1&period;45 0 3 1&period;69 3 3&period;5 0 1&period;41-&period;91 2&period;72-2 3&period;25V8&period;59c&period;58-&period;45 1-1&period;27 1-2&period;09C10 5&period;22 8&period;98 4 8 4H4c-&period;98 0-2 1&period;22-2 2&period;5S3 9 4 9zm9-3h-1v1h1c1 0 2 1&period;22 2 2&period;5S13&period;98 12 13 12H9c-&period;98 0-2-1&period;22-2-2&period;5 0-&period;83&period;42-1&period;64 1-2&period;09V6&period;25c-1&period;09&period;53-2 1&period;84-2 3&period;25C6 11&period;31 7&period;55 13 9 13h4c1&period;45 0 3-1&period;69 3-3&period;5S14&period;5 6 13 6z”&sol;><&sol;svg><&sol;a>Even More Enhancements<&sol;h3><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;<&sol;p><p>The following enhancements need to happen on the <code><form&sol;><&sol;code> instead of a honeypot field&period;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>The basic idea is to detect if the entry is potentially made by a human&period; There are many ways of doing that — and all of them require JavaScript&colon;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><ol class&equals;”wp-block-list”>&NewLine;<li>Detect a <code>mousemove<&sol;code> event somewhere&period;<&sol;li>&NewLine;&NewLine;&NewLine;&NewLine;<li>Detect a keyboard event somewhere&period;<&sol;li>&NewLine;&NewLine;&NewLine;&NewLine;<li>Ensure the the form doesn’t get filled up super duper quickly &lpar;&OpenCurlyQuote;cuz people don’t work that fast&rpar;&period;<&sol;li>&NewLine;<&sol;ol><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>Now&comma; the simplest way of using these &lpar;I always advocate for the simplest way I know&rpar;&comma; is to use <a href&equals;”https&colon;&sol;&sol;splendidlabz&period;com&sol;docs&sol;svelte&sol;forms&sol;form&sol;” rel&equals;”noopener”>the <code>Form<&sol;code> component<&sol;a> I’ve created in <a href&equals;”https&colon;&sol;&sol;splendidlabz&period;com” rel&equals;”noopener”>Splendid Labz<&sol;a>&colon;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><pre rel&equals;”Svelte” class&equals;”wp-block-csstricks-code-block language-markup” data-line&equals;””><code markup&equals;”tt”>&NewLine;&NewLine;<form>&NewLine; <honeypot name&equals;”honeypot”&sol;>&NewLine;<&sol;form><&sol;code><&sol;pre><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>If you use Astro&comma; you need to enable JavaScript with a client directive&colon;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><pre rel&equals;”Astro” class&equals;”wp-block-csstricks-code-block language-javascript” data-line&equals;””><code markup&equals;”tt”>—&NewLine;import &lbrace; Form&comma; Honeypot &rcub; from ‘&commat;splendidlabz&sol;svelte’&NewLine;—&NewLine;&NewLine;<form client&colon;idle&equals;””>&NewLine; <honeypot name&equals;”honeypot”&sol;>&NewLine;<&sol;form><&sol;code><&sol;pre><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>If you use vanilla JavaScript or other frameworks&comma; you can use the <code>preventSpam<&sol;code> utility that does the triple checks for you&colon;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><pre rel&equals;”JavaScript” class&equals;”wp-block-csstricks-code-block language-javascript” data-line&equals;””><code markup&equals;”tt”>import &lbrace; preventSpam &rcub; from ‘&commat;splendidlabz&sol;utils&sol;dom’&NewLine;&NewLine;let form &equals; document&period;querySelector&lpar;’form’&rpar;&NewLine;form &equals; preventSpam&lpar;form&comma; &lbrace; honeypotField&colon; ‘honeypot’ &rcub;&rpar;&NewLine;&NewLine;form&period;addEventListener&lpar;’submit’&comma; event &equals;&gt&semi; &lbrace;&NewLine; event&period;preventDefault&lpar;&rpar;&NewLine; if &lpar;form&period;containsSpam&rpar; return&NewLine; else form&period;submit&lpar;&rpar;&NewLine;&rcub;&rpar;<&sol;code><&sol;pre><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>And&comma; if you don’t wanna use any of the above&comma; the idea is to use JavaScript to detect if the user performed any sort of interaction on the page&colon;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><pre rel&equals;”JavaScript” class&equals;”wp-block-csstricks-code-block language-javascript” data-line&equals;””><code markup&equals;”tt”>export function preventSpam&lpar;&NewLine; form&comma;&NewLine; &lbrace; honeypotField &equals; ‘honeypot’&comma; honeypotDuration &equals; 2000 &rcub; &equals; &lbrace;&rcub;&NewLine;&rpar; &lbrace;&NewLine; const startTime &equals; Date&period;now&lpar;&rpar;&NewLine; let hasInteraction &equals; false&NewLine;&NewLine; &sol;&sol; Check for user interaction&NewLine; function checkForInteraction&lpar;&rpar; &lbrace;&NewLine; hasInteraction &equals; true&NewLine; &rcub;&NewLine;&NewLine; &sol;&sol; Listen for a couple of events to check interaction&NewLine; const events &equals; &lbrack;’keydown’&comma; ‘mousemove’&comma; ‘touchstart’&comma; ‘click’&rsqb;&NewLine; events&period;forEach&lpar;event &equals;&gt&semi; &lbrace;&NewLine; form&period;addEventListener&lpar;event&comma; checkForInteraction&comma; &lbrace; once&colon; true &rcub;&rpar;&NewLine; &rcub;&rpar;&NewLine;&NewLine; &sol;&sol; Check for spam via all the available methods&NewLine; form&period;containsSpam &equals; function &lpar;&rpar; &lbrace;&NewLine; const fillTime &equals; Date&period;now&lpar;&rpar; – startTime&NewLine; const isTooFast &equals; fillTime &lt&semi; honeypotDuration&NewLine; const honeypotInput &equals; form&period;querySelector&lpar;&grave;&lbrack;name&equals;”&dollar;&lbrace;honeypotField&rcub;”&rsqb;&grave;&rpar;&NewLine; const hasHoneypotValue &equals; honeypotInput&quest;&period;value&quest;&period;trim&lpar;&rpar;&NewLine; const noInteraction &equals; &excl;hasInteraction&NewLine;&NewLine; &sol;&sol; Clean up event listeners after use&NewLine; events&period;forEach&lpar;event &equals;&gt&semi;&NewLine; form&period;removeEventListener&lpar;event&comma; checkForInteraction&rpar;&NewLine; &rpar;&NewLine;&NewLine; return isTooFast &vert;&vert; &excl;&excl;hasHoneypotValue &vert;&vert; noInteraction&NewLine; &rcub;&NewLine;&rcub;<&sol;code><&sol;pre><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;<&sol;p><h3 class&equals;”wp-block-heading” id&equals;”better-forms”><a href&equals;”&num;aa-better-forms” aria-hidden&equals;”true” class&equals;”aal&lowbar;anchor” id&equals;”aa-better-forms”><svg aria-hidden&equals;”true” class&equals;”aal&lowbar;svg” height&equals;”16″ version&equals;”1&period;1″ viewbox&equals;”0 0 16 16″ width&equals;”16″><path fill-rule&equals;”evenodd” d&equals;”M4 9h1v1H4c-1&period;5 0-3-1&period;69-3-3&period;5S2&period;55 3 4 3h4c1&period;45 0 3 1&period;69 3 3&period;5 0 1&period;41-&period;91 2&period;72-2 3&period;25V8&period;59c&period;58-&period;45 1-1&period;27 1-2&period;09C10 5&period;22 8&period;98 4 8 4H4c-&period;98 0-2 1&period;22-2 2&period;5S3 9 4 9zm9-3h-1v1h1c1 0 2 1&period;22 2 2&period;5S13&period;98 12 13 12H9c-&period;98 0-2-1&period;22-2-2&period;5 0-&period;83&period;42-1&period;64 1-2&period;09V6&period;25c-1&period;09&period;53-2 1&period;84-2 3&period;25C6 11&period;31 7&period;55 13 9 13h4c1&period;45 0 3-1&period;69 3-3&period;5S14&period;5 6 13 6z”&sol;><&sol;svg><&sol;a>Better Forms<&sol;h3><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;<&sol;p><p>I’m putting together a solution that will make HTML form elements much easier to use&period; It includes the standard elements you know&comma; but with easy-to-use syntax and are highly accessible&period;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>Stuff like&colon;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><ul class&equals;”wp-block-list”>&NewLine;<li>Form<&sol;li>&NewLine;&NewLine;&NewLine;&NewLine;<li>Honeypot<&sol;li>&NewLine;&NewLine;&NewLine;&NewLine;<li>Text input<&sol;li>&NewLine;&NewLine;&NewLine;&NewLine;<li>Textarea<&sol;li>&NewLine;&NewLine;&NewLine;&NewLine;<li>Radios<&sol;li>&NewLine;&NewLine;&NewLine;&NewLine;<li>Checkboxes<&sol;li>&NewLine;&NewLine;&NewLine;&NewLine;<li>Switches<&sol;li>&NewLine;&NewLine;&NewLine;&NewLine;<li>Button groups<&sol;li>&NewLine;&NewLine;&NewLine;&NewLine;<li>etc&period;<&sol;li>&NewLine;<&sol;ul><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p><a href&equals;”https&colon;&sol;&sol;splendidlabz&period;com&sol;solutions&sol;forms&sol;” rel&equals;”noopener”>Here’s a landing page<&sol;a> if you’re interested in this&period; I’d be happy to share something with you as soon as I can&period;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;<&sol;p><h3 class&equals;”wp-block-heading” id&equals;”wrapping-up”><a href&equals;”&num;aa-wrapping-up” aria-hidden&equals;”true” class&equals;”aal&lowbar;anchor” id&equals;”aa-wrapping-up”><svg aria-hidden&equals;”true” class&equals;”aal&lowbar;svg” height&equals;”16″ version&equals;”1&period;1″ viewbox&equals;”0 0 16 16″ width&equals;”16″><path fill-rule&equals;”evenodd” d&equals;”M4 9h1v1H4c-1&period;5 0-3-1&period;69-3-3&period;5S2&period;55 3 4 3h4c1&period;45 0 3 1&period;69 3 3&period;5 0 1&period;41-&period;91 2&period;72-2 3&period;25V8&period;59c&period;58-&period;45 1-1&period;27 1-2&period;09C10 5&period;22 8&period;98 4 8 4H4c-&period;98 0-2 1&period;22-2 2&period;5S3 9 4 9zm9-3h-1v1h1c1 0 2 1&period;22 2 2&period;5S13&period;98 12 13 12H9c-&period;98 0-2-1&period;22-2-2&period;5 0-&period;83&period;42-1&period;64 1-2&period;09V6&period;25c-1&period;09&period;53-2 1&period;84-2 3&period;25C6 11&period;31 7&period;55 13 9 13h4c1&period;45 0 3-1&period;69 3-3&period;5S14&period;5 6 13 6z”&sol;><&sol;svg><&sol;a>Wrapping Up<&sol;h3><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;<&sol;p><p>There are a couple of tricks that make honeypots work today&period; The best way&comma; likely&comma; is to trick spam bots into thinking your honeypot is a real field&period; If you don’t want to trick bots&comma; you can use other bot-detection mechanisms that we’ve defined above&period;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p>Hope you have learned a lot and manage to get something useful from this&excl;<&sol;p><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine;&NewLine;&NewLine;<&sol;p><p&sol;><p style&equals;”display&colon; inline&semi;” class&equals;”WPAuto&lowbar;Base&lowbar;Readability-styled”>&NewLine;&NewLine; &NewLine; <&sol;p><&sol;div>