JavaScript Question – Hiding the Other Write-In Box


I am hoping that a Community member with superior JavaScript skills can help me with this.

There is a script in the Developer Resources section of the SurveyGizmo documentation that “hides” the Other write-in box until that option is selected  –

This script works great for radio button type questions.  It does not work as well in checkbox-type questions.  In these questions the write-in box will appear when the option is selected, but it will disappear if the respondent selects another option. The Other selection has to be the last selection, or the write-in box will disappear.

Allowing answers to disappear for no apparent reason violates several usability rules, so we are unable to use the script of the survey includes checkbox type questions with Other-Write-in options.

Does anyone know if this script can be fixed?  Thanks.

Lola Gill answered
    Lola Gill 6.99K Rep.

    I’ve been playing around with this and have gotten kind of closer (with my limited Javascript skills). Here is what I have:

    $SG(‘.sg-other input[type=text]’).hide();
    $SG(‘.sg-other input[type=text]’).show()

    The first part hides the other box by default when the page loads. The second part shows it after the specific associated checkbox is clicked. The part I haven’t worked out is once it is shown, if the respondent then un-selects the associated checkbox, the other box does not hide again…

    I know you posted this a while ago, but I thought I would share this in case it helps!

    Lola Gill answered


      Question stats

      • Active
      • Views5366 times
      • Answers1 answer
      • Followers1 follower