Tom5954785
Posts: 0
Joined: Fri Jun 14, 2013 9:24 pm

Toggle input element visibility by checkbox

Hi, thanks for a very good tool !

I want to have a number of input elements hidden, and toggle their visibility by a checkbox - if checked they are to appear visible.

checkbox onclick js:

$('.toggleclass').toggle('fast', function() {
});

By adding this to checkbox onclick js i am able to toggle if input elements are visible by default, however if i uncheck the visible option in input properties it will not toggle at all exept for label element, it does toggle.

Ive added classname "toggleclass" to those elements i need to toggle.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Toggle input element visibility by checkbox

HI,

Add next JavaScript code on checkbox "Value change" event. You should replace "mobilecheckbox_42" with yours checkbox element Name and ".inputelementclass" with input elements Class Name.
code
if ($('input', Appery("mobilecheckbox_42")).prop("checked"))
{ $('.inputelementclass').hide();
} else $('.inputelementclass').show();
/code

Tom5954785
Posts: 0
Joined: Fri Jun 14, 2013 9:24 pm

Toggle input element visibility by checkbox

I tried this solution and renamed name and class accordingly, but i am only able to hide the input element once if it is visible from the start, if i set it as hidden default it wont show..

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Toggle input element visibility by checkbox

It will be simple to hide input elements on page load event.

Return to “Issues”