Need some help with wix code


Hello. I am a big fan of wix, and love the new features Wix Code gives us. But i have one question. Is it possible, and how do i do it, to make it so a “please specify” text-input box appears, only if “other” is selected. So that it disappears if it is not selected? Not the most important part of wix code, i know, but it looks a little better this way. Thanks

Hi, if you’re not afraid to use a little JavaScript, it’s pretty easy. You can set the “please specify” input field to be hidden on load . Then, for your “other” option (I assume this is either a RadioButtonGroup or Dropdown), add an onChange event handler . In that onChange handler, add a line of code to show the “please specify” input field, and it will appear when the user clicks “other”.

Hope this helps!

Thank you so Much! Hehe i dont know javascript very well, do you think you could write the Code so it is available for copy/paste? Again thank you

Hi, if you follow the steps I outlined above, you should end up with code that looks like this:

export function RadioGroup1_change(event, $w) {
	//Add your code for this event here: 
}

Add a line of code to show the “please specify” input element, and it will look something like this:

export function RadioGroup1_change(event, $w) {
	//Add your code for this event here: 
	$w("#textInput1").show();
}

You might need to change the #textInput1 to the ID that corresponds to the correct input element.

Hope this helps!

Thank you so much