Hello Everyone,
I simply want a drop downs selection to enable or disable an input field. There are only two selections and one has the value of 1 and the other has the value of 0. Here is my code below, I know I am close but it is not working yet. Any help would be greatly appreciated.
export function dropdown3_change(){
if ($w( “#dropdown3” ).value === 1 ){
$w( “#input1” ).enable();
} else {
$w( “#input1” ).disable();
}
}
Thank you!
Thank you for sending the link, but still can’t figure it out.
This is the code I tried, but not sure why it isn’t working
export function dropdown3_change(event) {
($w( ‘#dropdown3’ ).value)
if ($w( ‘#dropdown3’ ).value=== 1 ) {
$w( ‘#input1’ ).enable()}
else {$w( ‘#input1’ ).disable()}
}
It will not work, because you compare apple with bannana. 
You compare STRING with NUMBER, this is not possible.
There are 2 solutions for this.
- you make it the lazy way, like i did ----> replace —> === with —> ==
- transform STRING into NUMBER, or NUMBER into STRING
How do i know this?
console.log(typeof $w('#dropdown3').value)
console.log(typeof 1)
Add this to your CODE.
Press F-12 in your google-web-browser and go to CONSOLE.
Look at the results, what do you see? ? ? (do not forget to publish site first !)
Or do it in your Wix-Editor-Console, look at the results at the bottom of your screen in the console-terminal.
How to fix it?
- Convert NUMBER into STRING:
let newValue = 1
console.log(typeof newValue)
let newValue = (1).toString()
console.log(typeof newValue)
- Convert STRING into NUMBER:
let newValue = "1"
console.log(typeof newValue)
let newValue = Number("1")
console.log(typeof newValue)
The LAZY-SOLUTION 
export function dropdown3_change(){
if ($w("#dropdown3").value == 1){
$w("#input1").enable();
}
else {$w("#input1").disable();}
}