I have following php with javascript code snippet.
 <td align="center">
    <select id = "selectedUnit" class="form-control" onchange="saveToDatabase(this.value,'Unit','<?php echo $ingredientArray[$i][0]; ?>')"><?php 
                                                $j=0;
                                                for($j=0;$j<count($unitTypeArray);$j++) { ?>
                                                    <option value="<?php echo $unitTypeArray[$j][0]; ?>" <?php if($ingredientArray[$i][4] == $unitTypeArray[$j][0]){ echo 'selected';} ?>><?php echo $unitTypeArray[$j][1]; ?></option><?php 
                                                } ?>
                                            </select>
    </td>
Above is my dropdown , what I want is to get the previous selected value on dropdown change event , like below.
function saveToDatabase(editableObj,column,id) {
    //editableObj gives me the currently changing value .
    // How I will get the previous selected value ?I am doing it as follows.
    var $selected = $(this).find(':selected');   
       var text = $selected.prev().text(); //previous value
}
Please help me on this .Thanks.
 
     
     
    