text: Q:
  
  Designing selectbox in joomla
  
  I have a selectbox in which options are coming from a module. Following is its code.
  <div id="dropdown">
  <form action="" method="post" name="country"><label for="country"></label>
  <select id="country" name="country" onchange="this.form.submit()">
  
  <?php
  
      $rows = Array('UAE', 'SA', 'OMAN');
  
  foreach($rows as $row){ 
  
      if($row == $session->get('cont')){ 
  
          $isSelected = ' selected="selected"'; 
      } 
      else { 
          $isSelected = ''; 
      } 
  
      echo "<option ".$isSelected.">".$row."</option>";
      }
  ?>
  
  </select>
  </form>
  </div>
  
  Now I want to show country flags with each option. Please suggest if there is any java-script plugin which I can use or any other simple way.
  
  A:
  
  Have you tried a search for country flag drop down jquery or similar? There are many options, personally I've used this jQuery plugin earlier. You should be able to integrate it with your existing code by editing the echo statement.
  Basically, you have to load the included .js and .css files, and make sure jQuery is included in your template.
  //include scripts in header. (Add jQuery if needed.)
  JHtml::_('script', JUri::base() . 'path/to/your/files/jquery.dd.min.js');
  JHtml::_('stylesheet', JUri::base() . 'path/to/your/files/dd.css', array(), true);
  JHtml::_('stylesheet', JUri::base() . 'path/to/your/files/flags.css', array(), true);
  
  //initiate the script
  $doc = JFactory::getDocument();
  $doc->addScriptDeclaration('
    jQuery(document).ready(function($) {
      $("#country").msDropdown();
    })
  ');
  
  Now modify your echo statement to something like this:
  echo "<option ".$isSelected." value='".$row."' data-image='/path/to/your/files/blank.gif' data-imagecss='flag ".strtolower($row)."' data-title='".$row."'>".$row."</option>;
  
  You might have to tweak the code a bit to work, I haven't tested it, but it's worth a shot.
  Another alternative (might be easier) is the Country Picker jQuery plugin, but it uses a <div> element instead of a regular dropdown list, and you would have to edit your PHP loop.
  Good luck.
  
  