Skip to content
Marketing

Will You Marry Me Code: Runaway No Button or Real Lock?

The Lock Challenge Team6 min read
Will You Marry Me Code: Runaway No Button or Real Lock?

A "will you marry me code" is one of two things: a small web page or script where the No button runs away from the cursor, or a virtual lock whose code the person has to find before the question appears. The coded page takes an evening and only works if you can get it onto her phone. The lock opens from a link and gives you a ring case that opens on video.

I read the four most visible open-source versions and the most-watched Python walkthrough before writing this, and my view is simple: code the page if you enjoy coding, but do not let it carry the actual moment.

  • 💍 Two meanings, "code" means either source code for a page or a lock code to find.
  • 📱 Phone problem, a script on your laptop never reaches her phone without extra work.
  • 🎬 Filmed finale, a ring case opens on video, with sound, when the right code lands.

What does a "will you marry me" code actually do?

A will you marry me code is a short program, usually HTML, CSS and JavaScript, that shows the question with a Yes button and a No button that dodges, shrinks or gives up. The joke is that "No" is never really available. The people searching this keyword mostly want that joke, ready to copy.

Which versions do people actually build?

Four patterns cover almost everything. The first is the Python version: the video "Ask Will You Marry Me with Python" by the channel desflash yt needs VS Code, Python and Pygame installed, then you run the file from the integrated terminal and the No button runs away.

The second is the plain web page. The repository SujinPhilip/willYouMarryme (59 commits, 5 stars and 11 forks on GitHub in November 2026) is pure HTML, CSS, JavaScript and Bootstrap, with separate pages for the question, the confirmation and the Yes screen.

The third adds polish. The Ven-Core template stops the No button after 10 clicks and plays background music, and ankanpy/will-you-marry-me (22 commits) uses React, TypeScript, Tailwind CSS and Vite, grows the Yes button each time No is clicked and ends on a canvas-confetti shower.

The fourth is the cinematic one: elifgazioglu/will-you-marry-me (14 stars) animates a plane carrying the proposal.

The code is never the hard part. Getting it in front of the right person at the right second is.

How do you code the runaway No button?

The runaway No button needs about fifteen lines of JavaScript: when the pointer touches No, move it to a random position and make Yes slightly bigger. Everything else in the repositories above (music, confetti, a cycling list of pleading messages) is decoration on top of that single trick.

Here is the core, with no framework:

<button id="yes">Yes</button>
<button id="no">No</button>

<script>
  const yes = document.getElementById("yes");
  const no = document.getElementById("no");
  let refusals = 0;

  no.addEventListener("pointerenter", () => {
    refusals++;
    no.style.position = "fixed";
    no.style.left = Math.random() * (innerWidth - no.offsetWidth) + "px";
    no.style.top = Math.random() * (innerHeight - no.offsetHeight) + "px";
    yes.style.transform = "scale(" + (1 + refusals * 0.15) + ")";
  });

  yes.addEventListener("click", () => {
    document.body.textContent = "She said yes!";
  });
</script>

I use pointerenter rather than mouseover because the Pointer Events API covers mouse, pen and touch in one handler, as documented on MDN Web Docs.

Why does it fail on a phone?

Your partner will almost certainly open the link on a phone, and that is where the joke breaks. There is no hover on a touchscreen, so the button only moves after the finger has already landed, and a random position can drop it under the browser toolbar.

Test on a real phone before the day. Also check the licence if you start from someone else's template: the Ven-Core repository is published under GPL-3.0, which comes with conditions when you reuse and redistribute it.

You can, but the hosting is the real project. A page needs a public address, and a script like the Python version never leaves your laptop unless you screen-share it or package it. A bare link in a message also arrives with no build-up: she taps, reads the question, and the moment you planned is a notification.

What changes when the code is a lock instead?

A virtual lock is a locked screen on a link that opens only when the player enters the right code, and Lock Challenge is a tool for building one without writing any code. For a proposal, the code becomes the ritual: she has to find or remember a number that belongs to the two of you, and the question appears only when she gets it right.

Lock Challenge locks open with filmed unlock animations: the object opens on video, with sound, when the right answer lands. For a proposal the matching object is the ring case, and the heart celebration plays as it opens.

What does a worked proposal look like?

Here is a two-lock trail you can set up in one evening. The first lock is a numeric lock. Its code is the date you met, as four digits (month then day), with the hint "The day I stopped pretending I was just passing by." The reveal behind it is a photo from that day and the next clue.

The second lock is the one that matters. Pick a code only she would know, such as the number of the street where you had your first dinner, and set the final reveal to your handwritten question plus a photo of the two of you.

When she types the last digit, the ring case lifts its lid on video, the sound plays, hearts fall across the screen and your question sits inside the opened case. You can film her reaction, because the sound and the animation are the moment.

You can build and preview a lock before paying anything. Open the marriage proposal template to see the ring case, or the custom virtual lock page to see the other filmed objects. To see how locked reveals work end to end, the locked drops page shows the same mechanic used for a different audience.

Which lock mechanic fits a proposal best?

For a first lock, I recommend the numeric lock: anyone can enter four digits on a phone without instructions. A musical lock suits a couple with a song, because the code is a melody she plays on an on-screen keyboard. GPS suits a proposal outdoors, where she has to be standing at the right spot.

For more on setting up a code-protected surprise, see virtual locks for surprises, and if you are planning the bridal party too, creative ways to ask your bridesmaids uses the same idea.

Which one should you pick: the page or the lock?

Pick the coded page if the project is the gift, meaning you want her to know you built it yourself. Pick the lock if the moment is the gift, meaning you want a link that works on any phone, a filmed ring case opening, and nothing that can crash.

Approach Setup Opens on her phone Best for Honest limit
Python script (Pygame) VS Code, Python, Pygame No, runs on your computer A proposal on your own laptop Needs screen-sharing or packaging to reach her
HTML, CSS and JS page Free hosting, a text editor Yes, with a tested layout The classic runaway No button Touchscreens have no hover, so test on a phone
React app with confetti Node, Vite, Tailwind Yes, once deployed Developers who like polish A build step for a one-time joke
Virtual lock with a filmed unlock animation A browser, no code Yes, from a link or QR code A ring case opening on video, with sound The code has to mean something only she knows

Source: GitHub repositories and YouTube video cited · Updated 11/2026

My verdict: write the No button if you are a developer, because it is a charming thing to have made. Then put the real proposal behind a lock, so the ring case opening is what she films and remembers. The page makes her laugh, and the lock is what she shows her family.

If you are ready to try it, start creating your challenge from the locked drops page, or see current plans and features on the pricing page.

FAQ

Can I use a GitHub "will you marry me" template for a real proposal?

Yes, as long as you respect its licence. Several repositories are open for reuse, but the Ven-Core template is GPL-3.0, which has conditions if you redistribute your modified version. Always test on the phone she will use, because the hover-based No button behaves differently on touchscreens.

How do I make a No button that runs away?

Listen for the pointerenter event on the No button and set its position to a random spot inside the window each time it fires. Add a growing Yes button by scaling it up on every attempt. The snippet in this article does both in about fifteen lines of JavaScript.

Is there a way to propose with a code without writing any?

Yes. A virtual lock hides your question behind a code she has to enter, and you share it as a short link or QR code. Lock Challenge locks open with filmed unlock animations, and the ring case template opens on video with sound when the right code lands.

How much does it cost to make a proposal lock?

Players never pay and need no account. See current plans and features on the pricing page.

What code should I choose for the lock?

Choose a number that only the two of you can connect: the date you met, a street number, a flight number or a birthday. Add a hint that points to the memory without giving the digits away. Avoid anything publicly findable, such as your wedding venue's address.

Sources

Keep reading

Get the Lock Challenge playbook

Escape-game ideas and lock tips in your inbox. No spam, unsubscribe anytime.

Prefer a reader? Subscribe via RSS