Prototype.js returns className instead of class in ie9
I am trying to create a new element and add a class for that element.
new Element('div',{'class':'name'});
Example Other browsers return
<div class="name"></div>
IE9 returns
<div className="name"></div>
How can we fix this problem in prototype.js
0
Mathi maheswaran
source
to share
2 answers
replace
new Element('div',{'class':'name'});
from
var mydiv = new Element('div');
mydiv.addClassName('name');
0
Reeno
source
to share
The version you are using is buggy in IE9 (haven't tested other versions of IE and other Prototype versions besides the ones below). I advise you to update Prototype. Check it out in the console (F12 tools):
Version 1.7:
(new Element('div', {className: 'buggy'})).outerHTML
returns "<div class="buggy"></div>"
(new Element('div', {class: 'buggy'})).outerHTML
returns "<div class="buggy"></div>"
Version 1.6.0.3:
(new Element('div', {className: 'buggy'})).outerHTML
returns "<div className="buggy"></div>"
(new Element('div', {class: 'buggy'})).outerHTML
returns "<div className="buggy"></div>"
(Sorry for the late answer, I just had to debug this in IE9)
0
user1274995
source
to share