Question: I have a trigger that i would like to do separate things depending on certain values. Can you write a case statement to do one thing else do something else Such as below? Is this possible?

```
Case WHEN value1 = 'A' and value2 = 'B' THEN
Insert table 1
WHEN value1 = 'A' and value2 = 'C' THEN
Insert table 2
END

```

Answer: 
You should use `filter` function in order to obtain `value` of option with `txt_scheme` text:

```
$(document).ready(function(){
    $("#txt_scheme").keyup(function(){
        var valueFromText=$("#scheme option").filter(function(i,option){
            return $(option).text()==$("#txt_scheme").val();
        }).val();
        $("#scheme").val(valueFromText);
    });
});

```

```js
$("#txt_scheme").keyup(function(){
        var valueFromText=$("#scheme option").filter(function(i,option){
            return $(option).text().toLowerCase()==$("#txt_scheme").val().toLowerCase();
        }).val();
        $("#scheme").val(valueFromText);
});
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select id="scheme">
   <option value="A">QC code</option> 
  <option value="B">Analyte</option>
  <option value="C">Assay Value </option>
  <option value="D">Assigned Value </option>
  <option value="E">STANDARDDEVIATION</option>
  <option value="F">ACCEPTABLEMIN</option>
  <option value="G">ACCEPTABLEMAX</option>
  <option value="H">Sample ID</option>
</select>
<input type="text" id="txt_scheme"/>
```
Use [`contains()`](http://api.jquery.com/contains-selector/) to grab the select option by its text value, and then set its `selected` attribute to true:

```
var textValue = $("#txt_scheme").val();
$("select option:contains("+textValue+")").attr('selected', true);

```