vendredi 6 mai 2016

Javascript function activating input fields after hit checkbox

I inherited the old code and trying to add some new functions. For now there is large form in 2 column table, first column has checkbox (yes/no), second input fields / textareas with description.

At checkbox are on the onclick event to check the condition and according to him, activate or block the second column.

I removed all the if statements and made big function full of if which check checkbox state and changing by element id state of input fields.

I wonder if you have idea how write univesal function to activate inputs in td next to that in which the checkbox is.

Function consisting of dozens of conditions to check the condition of one field and changing the status of another is a bad practice thats why I am asking you guys how to bite it.




Aucun commentaire:

Enregistrer un commentaire