- Joined
- Aug 15, 2011
- Messages
- 167
- Reaction score
- 15
Hello people,
I have a problem. I am trying to run some code but I get an error in my console.
This is my code:
The error:
I am calling the function with:
I also would like to add sme CSS to
but that causes the same error. Does anyone know why this is happening?
Thanks in advance!
I have a problem. I am trying to run some code but I get an error in my console.
This is my code:
PHP:
var Amber = {
Notification: function (type) {
this.message = null;
this.box = null;
switch(type) {
case 'bad':
this.box = '<div class="Notification bad><i class="icon-notok"></i>' + this.message + '</div>';
break;
case 'good':
this.box = '<div class="Notification good><i class="icon-ok"></i>' + this.message + '</div>';
break;
case 'informative':
this.box = '<div class="Notification informative><i class="icon-informative"></i>' + this.message + '</div>';
break;
case 'warning':
this.box = '<div class="Notification warning><i class="icon-warning"></i>' + this.message + '</div>';
break;
}
this.SetMessage = function (message) {
this.message = message;
return this;
}
this.Show = function () {
this.box.appendTo(document.body);
}
}
}
The error:
PHP:
TypeError: this.box.appendTo is not a function
I am calling the function with:
PHP:
new Amber.Notification.SetMessage('Some message').Show();
I also would like to add sme CSS to
PHP:
this.box
Thanks in advance!