I have been learning some jQuery and things are shaping up pretty well. But i have hit my head on the following thing.
In this bit of code that works fine there is a part where i am trying to get the lenght of the '
altVar' variable but nothing seem to happen.
The only thing i can think of is that '
altVar' is no longer a object and donīt have a lenght property ?
am i thinking in the wrong direction here or is the late hours making my brain a little fuzzy.
I turning to you JavaScript gurus here on the site.
Have a look at this code. It all works well except that i want the code in the IF statement only to be TRUE if the lenght of the string taken from the alt attribute of the targeted element is more then 0.
The return from '
var strLen = altVar.lenght' is '
undefined' ?
i donīt get it. Why ?
I should mention im a newbie in the JavaScript realm :)
If you need any other info to help me out, just tell me what you need :)
Thanks in advance.
Code:
$("a.menuLink").mouseenter(function() {
// Animate
$(this).animate({paddingLeft:"+20px"}, { duration: 400 });
// Get data out of elements alt attribute.
// also find out string lenght
var altVar = $(this).attr('alt');
var strLen = altVar.lenght;
// show status div only if string
// is more then 0 in lenght
if(strLen > 0)
{
$('#statusDiv').show();
$('#statusDiv').html(altVar);
}
});