I have no cunning at all about coding so will someone please help me with this? I want the white textbox to be hidden until a customer clicks on the green “Write a comment”-button. Please make a simple code for this and I will be very thankful. Can you also add a code that makes the box disappear when the customer have written something and clicks at Submit? The message will also be sent to another page with that click.
I tried with this but nothing happens when I click at Write a comment:
export function Knapp1_click ( event ) {
// This function was added from the Properties & Events panel. To learn more, visit Velo: Working with the Properties & Events Panel | Help Center | Wix.com
// Add your code for this event here:
$w ( ‘#Knapp1’ ). onClick (()=>{
$w ( ‘#Textbox1’ ). show ()
})
$w ( ‘#Submit1’ ). onClick (()=>{
$w ( ‘#Textbox1’ ). hide ()
//write the function you wanna run when the box has collapsed
})
}
$w . onReady (( x )=>{
These should work, but make sure you have everything set up correctly in the properties and events panel
Use this if you want just the write a comment button to toggle between the collapsed and expanded:
export function Knapp1_click(event){
if( $w("#Textbox1").collapsed ) {
$w("#Textbox1").expand();
}
else {
$w("#Textbox1").collapse();
}
}
Or if you want the write a comment to expand and submit to collapse it:
export function Knapp1_click(event){
$w("#Textbox1").expand();
}
export function Submit1_click(event){
$w("#Textbox1").collapse();
}
This should point you in the right direction of what to do.
Make sure you have everything set correctly in the properties and events panel
Thank you very much Noah! It works : )
Glad it helped. If you mark it best answer, that would be great