rottmanj
rottmanj

Reputation: 531

Prototype setting styles on an element

Within my prototype class, I have a function called loginSuccess. With in this function I have this bit of code $$('#cartov .overlay-login-display').setStyle({display: 'none'});

What I expected this to do was to hide the div. However, I get this exception: Exception : TypeError: $$("#cartov .overlay-login-display").setStyle is not a function

From everything that I have researched, this is the correct syntax. So I am not sure what I am doing wrong. Any help with this is greatly appreciated.

Upvotes: 4

Views: 3453

Answers (1)

John Conde
John Conde

Reputation: 219804

You need to use each()

$$('#cartov .overlay-login-display').each(function(ele) {
  ele.setStyle({display: 'none'})
});

Upvotes: 9

Related Questions