views:

251

answers:

3

Hello, i'm using mootools.js, i have this code:

this.html.chat_title = new Element('span', {
    'id' : 'chat_title',
    html : 'this is the title'
}).inject(this.html.container);

The problem is:

span id="chat_title" html="this is the title"

as you see it doesn't put the text inside the HTML of the tag but as an attribute.

What is wrong?

Thank you so much!

+1  A: 

It's valid code, so my only advice is to try downloading a full version of the MooTools Core, to make sure you're not missing a needed component (in case you downloaded using the Core Builder).

Zackman
A: 

Interesting.. are you using MooTools 1.1.2? I see the same on jsfiddle. html gets added as an attribute, instead of element's innerHTML.

I'd suggest you try upgrading if that is the case. 1.1.2 has been old for quite sometime now.

Anurag
Thats ok, if he's under 1.1.x, there is `.setHTML` and `.setText` methods. i am not saying he shouldn't upgrade, but there's no real need to (for this sake alone anyway). http://jsfiddle.net/EsbVW/2/
Dimitar Christoff
A: 

This is because there is no Element.Properties.html setter and getter in MooTools 1.1.2. You can use the setHTML method instead:

this.html.chat_title = new Element('span', {
    'id': 'chat_title'
}).setHTML('this is the title').inject(this.html.container);

Otherwise create your own setter and getter or update to a newer version of MooTools.

Ronald