Making a translator using jQuery

Making a translator using jQuery



I'am trying to make a translator but it doesn't work, when I write something in
the textarea which is in my array, it must write in the other textarea "Done" but it doesn't.


jQuery('document').ready(function ()
var $write = jQuery('textarea[name=edit]')
var $read = jQuery('textarea[name=unedit]')
var words = ["mouse", "head", "month"]
var $button = jQuery('button')
$button.click(function ()
for (var i = 0; i <= words.length; i++)
if ($write == words[i])
$read.text("Done")

else
setInterval(function ()
$read.text("Undone((")
, 1500)


)
)





its working for me , check if you getting $write or not,
– Ahmed Sunny
Aug 28 at 9:14





I used val , it didn't work
– Tigran Avagyan
Aug 28 at 9:16





When someone asks a question about a problem with their code, we need to know what is wrong with it. Stating that “it doesn’t work” is not helpful.
– Liam
Aug 28 at 9:21




1 Answer
1



$write is an object that references your textarea. You need to use .val() to retrieve its text, like this:


$write


.val()


if ($write.val() == words[i]) {



Also the rest of your logic can be better, e.g. you now add multiple timers that keep writing "Undone((" which does not make much sense.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ

How do I collapse sections of code in Visual Studio Code for Windows?