Martin Suchan – BloQ Random #WPdev stuff

14May/110

Creating ‘select multiple’ element in IE6 using jQuery

I was facing recently strange problem with creating <select> tag with 'multiple' attribute in IE6. Normally it's done using $("<select>").attr("multiple", true), but this does not work in IE6 - the crated select element was simple every time, without multiple choices. Setting 'multiple' attribute in IE6 programatically just doesn't work. I spent lot of time finding some workaround, but the solution I discovered is pretty simple, just use this object constructor:

$("<select multiple='multiple'>")

It's not 100% clean solution, but it works in IE6 and that's important.

If you know better solution, you might update the jQuery I created for this issue: http://bugs.jquery.com/ticket/9231

Tagged as: , No Comments