These lines in jquery making me bad:
var selectBoxContainer = $('<div>',{width: select.outerWidth(), className:'styledSelect', html:'<div class="selectBox"></div>'});
var dropDown = $('<ul>',{className:'dropDown'});
It should set the class attribute "class="styledselect" in the output, but the attribute's name is "classname":
<div classname="styledSelect">
<ul classname="dropDown" style="display: none;">...</ul>
</div>
when I change it simply to {class:'dropDown'}
ist works in firefox, but not in other browsers.
help please...
These lines in jquery making me bad:
var selectBoxContainer = $('<div>',{width: select.outerWidth(), className:'styledSelect', html:'<div class="selectBox"></div>'});
var dropDown = $('<ul>',{className:'dropDown'});
It should set the class attribute "class="styledselect" in the output, but the attribute's name is "classname":
<div classname="styledSelect">
<ul classname="dropDown" style="display: none;">...</ul>
</div>
when I change it simply to {class:'dropDown'}
ist works in firefox, but not in other browsers.
help please...
Share Improve this question edited Nov 18, 2011 at 9:21 user166390 asked Nov 18, 2011 at 9:11 ThomaszterThomaszter 1,4741 gold badge13 silver badges26 bronze badges4 Answers
Reset to default 11Try:
{ "class": "dropDown" }
or add .addClass("drowDown")
to the end.
Use
{'class': 'dropDown'}
class
is a future reserved word in JavaScript, so you must specify it as a string inside object literals for some browsers, notably IE 8 and lower.
The simplest way would to use the following:
var dropDown = $('<ul>').addClass('dropDown');
Use the jQuery native methods, they're made for this. It's also much more readable this way.
{'class':'dropDown'}
should work in all browsers. Alternatively, you could try
dropDown.addClass("dropDown");
Good luck!