var a; var b; function update(input) { a = $(input); b = a.val().length; // далее код с переменные работает } here is the function call
$("#jack").click(function () { update(this); }); But immediately upon exiting the function, these variables are equal to undefined. Why are they reset?
function update(input) { ... }. - Igor