select options of a select element that loaded on runtime

I am using the jQuery to remove options of select and add new option. It is working fine and options change dynamically. However, when i want to select an option do not work. I am using val() property to get specific option. Here is a sample of the code:

html code :

<select id="cmb_signer"  name="signer" class="right"  style="width:100%"></select>

jquery code to change options:

   $('#cmb_signer').empty().append('<option value="0">select...</option>' + data);

the fetch_signer.php file:


  $sql=mysql_query("SELECT * FROM tbl_modiran WHERE emzagroup=$type");
  if($count > 0){
       echo("<option value=".$id.">".$row['name']." ".$row['family']."</option>");
     echo("<option value='0'>noting to show</option>");

and jquery code to change the options:






Answers 1

Related Articles