Hello!
Please tell me how you can fix this error: Uncaught TypeError: y is not a function
function test($t, y) { y($.trim($($t).val())); } function validateTest(z){ alert(z); } $('.requed').on('change', function() { test('#'+$(this).attr('id'), 'validate'+$(this).attr('data-var')); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <p> <label for="signin-login">Логин</label> <input class="full-width requed" id="signin-login" data-var="Test" type="text" placeholder="Логин" name="login"> <span class="cd-error-message"></span> </p> As I understand it, an error occurs when trying to call a value as a function. I need this way. I have many fields and based on the value ( 'validate'+значение из data-var ) that came from the field, a certain function will be called.