Using this plugin:
http://plugins.jquery.com/project/selectboxes
Getting this error in IE8 and Safari:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; Creative AutoUpdate v1.40.03)
Timestamp: Mon, 22 Feb 2010 21:36:23 UTC
Message: 'constructor' is null or not an object
Line: 329
Char: 2
Code: 0
URI: js/jquery.selectboxes.js
Here is the function:
$.fn.selectOptions = function(value, clear)
{
var v = value;
var vT = typeof(value);
// handle arrays
if(vT == "object" && v.constructor == Array)
{
var $this = this;
$.each(v, function()
{
$this.selectOptions(this, clear);
}
);
};
var c = clear || false;
// has to be a string or regular expression (object in IE, function in Firefox)
if(vT != "string" && vT != "function" && vT != "object") return this;
this.each(
function()
{
if(this.nodeName.toLowerCase() != "select") return this;
// get options
var o = this.options;
// get number of options
var oL = o.length;
for(var i = 0; i<oL; i++)
{
if(v.constructor == RegExp)
{
if(o[i].value.match(v))
{
o[i].selected = true;
}
else if(c)
{
o[i].selected = false;
}
}
else
{
if(o[i].value == v)
{
o[i].selected = true;
}
else if(c)
{
o[i].selected = false;
}
}
}
}
);
return this;
};