Set digit pattern to Solution captcha
This commit is contained in:
parent
1d72fe222b
commit
419334febe
1 changed files with 2 additions and 4 deletions
|
@ -4,11 +4,9 @@
|
|||
|
||||
const a = Math.floor(Math.random() * 80) + 20
|
||||
const b = Math.floor(Math.random() * 80) + 20
|
||||
let ok = true
|
||||
const eventDispatcher = createEventDispatcher()
|
||||
function newValue(val: number) {
|
||||
ok = a + b == val
|
||||
if (ok) {
|
||||
if (a + b == val) {
|
||||
eventDispatcher("done")
|
||||
}
|
||||
}
|
||||
|
@ -16,5 +14,5 @@
|
|||
|
||||
<div>
|
||||
<p>Úlohu zatím nemáš vyřešenou, opravdu si chceš vyzradit řešení?</p>
|
||||
{a} + {b} = <input type=text pattern={"" + a + b} on:input={e => newValue(+e.currentTarget.value)}>
|
||||
{a} + {b} = <input type=text pattern="[0-9]+" on:input={e => newValue(+e.currentTarget.value)}>
|
||||
</div>
|
||||
|
|
Reference in a new issue