Iterating thro a list of elements and getting their ID back in an Array

Iterating thro a list of elements and getting their ID back in an Array

Hi all,
I am new to Jquery and still trying to feel my way around it. I have this piece of code snippet below               

// Html Code that will be generated dynamically - display of company names with close("X") icon next to the name of the company
   
                <div>                        
                    <div class="result" id="companyName">
                        <span class="ui-icon ui-icon-close"></span>
                        <div id="3">Company1</div></div>
                    <div class="result" id="companyName">
                        <span class="ui-icon ui-icon-close"></span>
                        <div id="7">Company2</div>
                    </div><div class="result" id="companyName">
                        span class="ui-icon ui-icon-close"></span>
                        <div id="11">Company3</div></div>
                </div>

I am successful in displaying the id(shaded) and the html text i.e.,the company name using the below mentioned code snippet.I key into the div element using the id which is companyName.         
             
                $("button#submit").click( function() {        
                    results = $("#companyName div");
                    results.each( function(){ alert( $(this).html() ) });                
                    results.each( function(){ alert( $(this).attr("id") ) });                
                });               

But I am not sure how to get the list of id into an array variable, Any ideas or suggestion towards the solution would be greatly helpful. thank you