How do I find the width of a dynamically added select box?

How do I find the width of a dynamically added select box?

Suppose I have some javascript that adds a select box, and populates it with options - something like:

  1. select = document.createElement("select");
  2. select.id = theid;

So assume I have filled the listbox with elements, and now I want to know how wide it is. 

I tried checking $("#" + theid).width(); but that did not work.

Is there another way?

Thanks.