Hi ,
I need help for this problem:
On my code - based on the value of a dynamic field - #text4
it should collapse a container #wixquotes1 or expand it.
currently when I preview the code below, it gives me the error
"TypeError: Cannot convert undefined or null to object "
$w.onReady(() => { if (Number(valueOf($w('#text4'))) !== 0) { console.log("Here") $w("#wixquotes1").collapse() } else { $w("#wixquotes1").expand() } });
Am unable to figure out whats going wrong. Please help.
Thanks
I responded to this in your other post on the same subject.
Andreas, for some strange reason it is not working now. I just updated the script as below:
$w.onReady(() => { if (Number($w('#text4').value) === 0) { console.log("Here") $w("#wixquotes1").collapse() } else { console.log("Else") $w("#wixquotes1").expand() } });
Am unsure whats going on.
My programming skill Level is Novice so sorry to bother you.
Does it have the ID of text4 in the properties panel? - yes
And you have added a TextInput you sure? Not some TextBox? Its a TextBox connected to the Database
Does it have the ID of text4 in the properties panel? And you have added a TextInput you sure? Not some TextBox?
https://www.wix.com/code/reference/$w.TextInput.html#value
Thanks a Ton Andreas it worked.
However in the editor it shows a Red Dot next to the statement when i type value with the error "Value does not exist on #text4"
Don't know why this comes but it still works.
Cheers.
Try to modify this
if (Number($w('#text4').value) !== 0) {