you can be lazy and do:

var prop = thisl.getElements('a').get('href').getLast();

it's not the most performant.

On 3 October 2012 11:39, Arian Stolwijk <stolwijk.ar...@gmail.com> wrote:
> $() and .getElement() can return null if the element doesn't exist.
> So if you're not sure the element exists, you'll have to check it indeed
> with an if statement.
>
>
> On Wed, Oct 3, 2012 at 12:36 PM, Hamburger <bilidi...@web.de> wrote:
>>
>> Hello,
>> please let me have one more beginner question.
>> With the following test I will get an error if the 'a' - element doesnt
>> exsist.
>> var test = this.getElement("a").get("href");
>>
>> What I would like to have is a 'null' or 'undefined'
>>
>> Do I have todo it realy like this:
>> var test = this.getElement("a");
>> if (test) {test=test.get("href");}
>>
>> or is there a shorter other way to do this.
>
>



-- 
Dimitar Christoff

"JavaScript is to JAVA what hamster is to ham"
@D_mitar - https://github.com/DimitarChristoff

Reply via email to