i have basic js knowledge.
i need trigger function below when of fields change in from. here works when var2 changes need triggered when of var# change. (i have 30 var @ end in form)
i think need have or condition, "if (var1.onchange or var2.onchange or ...) function()"
thanks in advance valuable input!
<script> window.onload = function () { var var0 = document.getelementbyid('field09') var1 = document.getelementbyid('field10') var2 = document.getelementbyid('field11') storage = document.getelementbyid('field12') var2.onchange= function() { storage.value = var0.value+" ; "+var1.value+" ; "+var2.value; }; }; </script>
please try this:
window.onload = function () { var var0 = document.getelementbyid('field09'), var1 = document.getelementbyid('field10'), var2 = document.getelementbyid('field11'), storage = document.getelementbyid('field12'), trigfunc = function(){ storage.value = var0.value + " ; " + var1.value + " ; " + var2.value; } var0.onchange = trigfunc; var1.onchange = trigfunc; var2.onchange = trigfunc; }
demo: jsfiddle
Comments
Post a Comment