Find width max width of a div and assign the width to all div's

Find width max width of a div and assign the width to all div's

Dear Sir

I am using following code to display 'Period'
Being dynamic (creading using do while loop of php using MYSQL database)
, i dont know the width of the same

I want to assign the max width of the div to all DIV's having class 'period


  1.    <div style="  font-family: 'Arial', sans-serif; font-size:16px; color:#fff; font-weight:bold; background-color:#006699; width:100%; id='<?php echo 'period'.$rows['id'];?> "; class="period" ><?php echo $rows['period'];?></div>

I tried
  1. $(document).ready(function() { 
  2.  
  3. var maxWidth=0; 
  4. $('.bigsaleperiod').each(function() { 
  5.     maxWidth = Math.max(maxWidth, $(this).width()); 
  6.  
  7. }).width(maxWidth);


  8. var maximgWidth1=0; 

  9. $("[id^=period]").each(function() { 
  10.     maximgWidth1 = Math.max(maximgWidth1, $(this).width());
  11.  
  12.  
  13. }).width(maximgWidth1);
  14. });
What's wrong with the code ?

I had changes following working code for height .....just changes height to width

  1. var maxHeight=0; 
  2. $('.team').each(function() { 
  3.     maxHeight = Math.max(maxHeight, $(this).height()); 
  4.  
  5. }).height(maxHeight);
  6. });

  7. var maximgHeight1=0; 

  8. $("[id^=team]").each(function() { 
  9.     maximgHeight1 = Math.max(maximgHeight1, $(this).height());
  10.  
  11.  
  12. }).height(maximgHeight1);