Can some help me with this code? It is not printing required input, why second textarea is not disabled even first one is empty? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can some help me with this code? It is not printing required input, why second textarea is not disabled even first one is empty?

https://code.sololearn.com/Wqzhttr3J6ef/?ref=app

27th Sep 2019, 1:48 PM
Abhay Rao
Abhay Rao - avatar
4 Answers
+ 1
I will try and help you. Firstly, you want the second textarea to be disabled when first one is empty right? Are you aware you can make second one read-only anyway so that text can't be manually written into it? Would that suit you better?
27th Sep 2019, 8:23 PM
Russ
Russ - avatar
+ 1
How can I make is read-only ?
28th Sep 2019, 7:59 AM
Abhay Rao
Abhay Rao - avatar
0
To make it read-only, on the textarea tag on the HTML page, just add readonly="true"
28th Sep 2019, 8:32 AM
Russ
Russ - avatar
0
Your main issue now is that you have a problem with the 'scope' of your variables. The scope refers to where that variable may be referenced from. This may be global (accessible from anywhere), or only accessible from within a particular function, or only within a particular code block. This depends on how they are created in the first place. At the current moment, your unText and enText variables have been created within your decrypt() function, meaning that they only 'exist' within that function. Where you're trying to refer to that variable inside your loadWindow() is where your error is.
28th Sep 2019, 8:39 AM
Russ
Russ - avatar