![]() |
Accessing Lenght of a string in Javascript with jQuery
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() { |
There is no lenght property, the correct English word (and indeed the correct property name) would be length
|
Quote:
Ofcourse that would be the problem :) And the late hours here in sweden :) Thx, Salathe your a godsend :) |
Edit: Now the code works perfectly the way i want :)
Note to self :) property is 'length' not 'lenght' |
Quote:
|
| All times are GMT. The time now is 06:34 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0