Search code examples
jquerycssvisibilityshow-hidejquery-mobile-flipswitch

Toggle visibility of a form element


I'm trying to toggle the visibility of a form element using jQuery. I have a flipswitch widget and am setting it's class with either the class='reviewControls' or data-wrapper-class='reviewControls' attributes, as can be seen in this fiddle. The problem is that it's working in the fiddle, but not in my code. My code hides the <label> field but not the <input> field. I'm finding it hard to debug as jQuery adds style="display: none; to the <label> element but leaves the <input> element (and it's styles) unchanged. Any ideas?


Solution

  • I couldn't seem to solve this problem, but wrapping the element in another <div> and then hiding that new <div> solved the problem.