So I am new to JavaScript and jQuery and I can't figure out why my variables are "undefined."
This is what I am doing: http://jsfiddle.net/krECX/15/
What I don't understand is why the variable $asdf is undefined when I call the $asdf.length in this function:
function func() {
var $asdf = $('#inp').value;
$('#divOfDoom').hide().html("" + $asdf.length).fadeIn('fast');
}
I'm sure I'm doing something stupid but every example I have found does something identical to my eyes.
What I have tried:
var $asdf = createInstance();
alert('' + $asdf); returns 'undefined' regardless of what is in the input box.
Any advice is appreciated.